-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate unable to find entity in the database with L2Cache
PostPosted: Wed Jan 29, 2014 12:46 pm 
Newbie

Joined: Wed Jan 29, 2014 12:38 pm
Posts: 1
After adding level 2 cache hibernate is returning null for an entity. Hibernate returns null for the entity (TrackingItem) because it can't find a ManyToOne relationship (Navigation) in the cache. When it attempts to query the database for the Navigation the query returns 0 rows even though it exists in the database. Without level 2 cache hibernate is able to find the entity in the database.

Here's my environment:
Server: JBoss EAP 6.1
Hibernate 4.2.0.Final
Infinispan: 5.2.6.Final

I have a question out on stackoverflow (http://stackoverflow.com/questions/21417860/hibernate-unable-to-find-entity-in-the-database-after-adding-second-level-cache) regarding this issue with the full details. I'm posting this here in hopes a few more people see it and have some ideas on why Hibernate can't find the Navigation in the database and then returns null for the TrackingItem.

Any help would be appreciated.


Top
 Profile  
 
 Post subject: Re: Hibernate unable to find entity in the database with L2Cache
PostPosted: Fri Jan 31, 2014 5:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 18, 2012 5:03 am
Posts: 36
Location: Fort Wayne, Indiana, USA
Would you be willing to create an HHH JIRA ticket for this, including a runnable test case that shows what you're describing? https://hibernate.atlassian.net


Top
 Profile  
 
 Post subject: Re: Hibernate unable to find entity in the database with L2Cache
PostPosted: Tue Feb 04, 2014 10:57 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 18, 2012 5:03 am
Posts: 36
Location: Fort Wayne, Indiana, USA
Actually, in taking a quick look at this, you're using Dates/Calendars within your PKs. Generally, that is a really bad idea and can cause issues within core ORM itself. Adding in caching on top of that is worse. I'd highly recommend changing this up to use non-Date identifiers...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.