This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate/JPA Dealing with entities with the same name in different persistence units

 
John Ament
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I looked at how they setup the databases, I didn't think it would be an issue, but apparently it is.

Basically, we have schemas in multiple database that match almost exactly. For the sake of what I'm doing, all affected entities are the same in all 8 schemas. My application runs on jboss 5.1 and uses the latest hibernate on there (I assume a 3.2 release). All of the databases are oracle. When I run a query for one of these objects, I get no results, even though there are results. I refactored my code to use a PK find in the EM, and the result was the below stack trace:



The way my code works is that for each of these 8 schemas, there's a different persistence unit. My understanding was that the mapping was local to the persistence unit (similar to the hibernate mappings and each individual session factory). Was I wrong on this one?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic