• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting the name of an Objects Persistence Unit  RSS feed

Matt Middleton
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?
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!