Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » getSingleResult return no entity even if should be return one
getSingleResult return no entity even if should be return one [message #1782826] Fri, 02 March 2018 08:14 Go to next message
IT Services is currently offline IT ServicesFriend
Messages: 2
Registered: March 2018
Junior Member
In my application, running on Payara (we've tried several release, from 164 to 174) and mysql, we use a query that retrieve some stable information about customer configuration.
The data in that table are quite stable (they are rarely edited, so no changes are occuring when the error appears neither write lock should be present).
We have some EJBs running (they run more or less every minute) launching one thread for each customer configuration, asking to retrieve those configuration details
Some times, some of those thread, at the same time, failed because of "return no entity", that's impossible. I've printed also the query that is launched, and it's correctly populated

No other error are launched in combination with this.

Seems like the db answer with empty response

Some time I receive independently from this error another error related to the db, com.sun.enterprise.resource.ConnectorXAResource handleResourceException, for a null pointer at com.sun.enterprise.resource.ConnectorXAResource.getResourceHandle(ConnectorXAResource.java:264). I don't think they are directly related, but they could depend both from the same problem
Re: getSingleResult return no entity even if should be return one [message #1783144 is a reply to message #1782826] Thu, 08 March 2018 13:41 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
This could happen in Eclipselink if conforming was enabled, and an entity was deleted locally but not yet flushed to the database. You mentioned this data was stable though, and you would know by checking your code, so I don't think it likely.

You will likely have to look at the database and its settings to figure out what might be going wrong, being sure to check the driver and database versions for any bugs that might be related.
Re: getSingleResult return no entity even if should be return one [message #1783149 is a reply to message #1783144] Thu, 08 March 2018 14:08 Go to previous message
IT Services is currently offline IT ServicesFriend
Messages: 2
Registered: March 2018
Junior Member
Hi,
Thanks for the reply
We have the same problem either with mariadb or mysql, using both connectors (the last downloadable)

In the application we have an entity (unmanaged because is open in a new thread/transaction by annotating with REQUIRES_NEW) called mailbox
the cal is
Configuration configuration = mailbox.getOwner().getCustomer().getConfiguration(); 

the getOwner part is
   public User getOwner()
    {
        if (owner == null) {
            owner = userHelper.getUserByMailbox(this);
        }

        return owner;
    }

UserHelper is annotated as EJB, and getUserByMailbox return from a query with a getSingleResult
The get customer part is
    public Customer getCustomer()
    {
        if (customer == null) {
            customer = customerHelper.getCustomerByUser(this);
        }
        return customer;
    }



Again, CustomerHelper is aan EJB, and this method (getCustomerByUser) )have no result
User and Customer are persisted to the DB, with no modification to both, and did no exist a user without customer

I don't know how investigate more, also regarding DB settings, because is a problem that happen only sometimes, while that row of code is called more or less 20.000 times a day, and it fail less than 10 times a day
Previous Topic:Indirection Issue - QueryBasedValueHolder incompatible
Next Topic:Cant prevent transient fields from being copied from shared cache to entity manager instances
Goto Forum:
  


Current Time: Thu Apr 18 22:59:14 GMT 2024

Powered by FUDForum. Page generated in 0.02494 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top