Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting the name of an Objects Persistence Unit

 
Matt Middleton
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an application where the classes are spread out across several persistence units. I am working on a way to Audit the application and am using the SessionFactory.getClassMetadata() method to get the metadata so I can get the table name I am working with. The problem I'm running into is that the SessionFactory has to be created with the correct persistence unit for the object or else it getClassMetadata returns null, and I don't have the name of the persistence unit or the correct SessionFactory when I'm auditing. Is there a way to look up the persistence unit if I have the class name?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic