Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

 
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?
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic