-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: Entity not loading when multiple keys to load(MOngoDB)
PostPosted: Mon Aug 29, 2016 9:39 am 
Newbie

Joined: Mon Aug 29, 2016 9:29 am
Posts: 4
Though the entity is there and loading when ManyToMany contains one single key, failing when 2 or more keys associated.

Code:
Caused by: javax.persistence.EntityNotFoundException: Unable to find com.stepSolar.web.ogm.entities.installer.InstallerSize with id 1
   at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$JpaEntityNotFoundDelegate.handleEntityNotFound(EntityManagerFactoryBuilderImpl.java:144) ~[hibernate-entitymanager-5.0.9.Final.jar:5.0.9.Final]
   at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227) ~[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
   at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:278) ~[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
   at org.hibernate.event.internal.DefaultLoadEventListener.doOnLoad(DefaultLoadEventListener.java:121) ~[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
   at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:89) ~[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
   at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1129) ~[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
   at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:1022) ~[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
   at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:632) ~[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
   at org.hibernate.type.EntityType.resolve(EntityType.java:424) ~[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
   at org.hibernate.ogm.type.impl.GridTypeDelegatingToCoreType.resolve(GridTypeDelegatingToCoreType.java:155) ~[hibernate-ogm-core-5.0.1.Final.jar:5.0.1.Final]
   at org.hibernate.ogm.type.impl.ManyToOneType.nullSafeGet(ManyToOneType.java:35) ~[hibernate-ogm-core-5.0.1.Final.jar:5.0.1.Final]
   at org.hibernate.ogm.persister.impl.OgmCollectionPersister.readElement(OgmCollectionPersister.java:237) ~[hibernate-ogm-core-5.0.1.Final.jar:5.0.1.Final]
   at org.hibernate.collection.internal.PersistentBag.readFrom(PersistentBag.java:95) ~[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
   at org.hibernate.ogm.loader.impl.OgmLoader.readCollectionElement(OgmLoader.java:734) ~[hibernate-ogm-core-5.0.1.Final.jar:5.0.1.Final]


Tried to debug it and found this

Code:
"dbObject.get( ID_FIELDNAME )"    (id=500)   
   value   1   
"searchObjects[i]"    (id=411)   
   value   1   
dbObject.get( ID_FIELDNAME ).equals(searchObjects[i])"   false   


org.hibernate.ogm.datastore.mongodb.MongoDBDialect Line 200, the check is getting failed where as it should not.


Top
 Profile  
 
 Post subject: Re: Entity not loading when multiple keys to load(MOngoDB)
PostPosted: Tue Aug 30, 2016 1:40 am 
Newbie

Joined: Mon Aug 29, 2016 9:29 am
Posts: 4
Upgraded to use 5.0.1.Final, moved back to 4.2.0.Final OGM and every thing running smooth now, but there is this problem in 5.0.1.Final


Top
 Profile  
 
 Post subject: Re: Entity not loading when multiple keys to load(MOngoDB)
PostPosted: Tue Aug 30, 2016 8:30 am 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 295
Could post some more details about this? Even better if you can post some code that reproduce the exception.

Thanks


Top
 Profile  
 
 Post subject: Re: Entity not loading when multiple keys to load(MOngoDB)
PostPosted: Tue Aug 30, 2016 8:48 am 
Newbie

Joined: Mon Aug 29, 2016 9:29 am
Posts: 4
In the parent JPA Entity say "Campaign" I have following attributes

Code:
   @ManyToMany(fetch=FetchType.EAGER)
   private List<InstallerSize> installerSizeList = new ArrayList<InstallerSize>();
   
   @ManyToMany(fetch=FetchType.EAGER)
   private List<InstallerPackaging> installerPackagingList = new ArrayList<InstallerPackaging>();


When there are more then 1 InstallerSize or InstallerPackaging associated with "Campaign" I was getting the exception that ENtity cannot be found.

In Mongo db the Part of Campaign was like

Code:
     "installerPackagingList" : [
        1
    ],
    "installerSizeList" : [
        "1",
        "2"
    ],


So on InstallerSize HIbernate was failing saying that InstallerSize with id 1 cannot be found but when I change installer size list in db like
Code:
    "installerSizeList" : [
        "1"
    ]

It works fine i.e with one record.

One important thing to notice in Exception stack trace above is
Code:
  at org.hibernate.ogm.type.impl.ManyToOneType.nullSafeGet(ManyToOneType.java:35) ~[hibernate-ogm-core-5.0.1.Final.jar:5.0.1.Final]


Because some manytoOneType is in action in manyto many relation I defined in "Campaign" i.e parent object, but that is my rough guess.


Top
 Profile  
 
 Post subject: Re: Entity not loading when multiple keys to load(MOngoDB)
PostPosted: Wed Aug 31, 2016 10:22 am 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 295
I've tried to create a test but I cannot reproduce the issue.

I think the best course of action would be to provide a test that reproduce the issue so that I can check what's causing it.


Top
 Profile  
 
 Post subject: Re: Entity not loading when multiple keys to load(MOngoDB)
PostPosted: Wed Aug 31, 2016 10:25 am 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 295
As a starting point, you could hava a look at this test: https://github.com/hibernate/hibernate- ... aTest.java


Top
 Profile  
 
 Post subject: Re: Entity not loading when multiple keys to load(MOngoDB)
PostPosted: Thu Sep 01, 2016 1:42 am 
Newbie

Joined: Mon Aug 29, 2016 9:29 am
Posts: 4
Sure, when ever I will face it again will post.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.