[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Acces Configuration/Persistent Class at run time for rea

ilavenila do-not-reply at jboss.com
Wed Oct 8 18:54:37 EDT 2008


Thanks Matt for your reply. I do not want to access the underlying entity class but the PersistentClass (org.hibernate.mapping.PersistentClass) created by hibernate when it loads the persistence unit.

The HbmBinder creates RootClass ( org.hibernate.mapping.RootClass) which extends or.hibernate.mapping.PersistentClass when hibernate loads the persistence unit. This can easily be accessed from the configuration object using configuration.getClassMappings(). Hence the need to access configuration object at runtime. Hope it makes sense!

Why I need this: I need access to this so that I can pass this to Envers (another Jboss project) to create mapping for my versioned entities.

At the moment, I intercept the loading of persistence unit and put these classes in a cache to access it at a later point of time. This is kind of workaround. But I was expecting hibernate to give me access to the classes (atleast for read-only purposes). Please let me know if you have a better way to implement this. Thanks!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4181128#4181128

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4181128



More information about the jboss-user mailing list