Hi,
My application associates LDAP type information (user id, last name, etc.) with application specific information (additional user information that is not stored in LDAP). I would like to have two modules and swap them based on a configuration flag. One module accesses LDAP directly and the other simulates LDAP by using a table. I would like to house my DB module in a different schema than the application schema.
Obviously, there are associations between entities, such as a one to many association between the LDAP "table" and the Service table.
So, my first question is, "does Hibernate handle associations between entities that sit in different schemas?"
My second question is "can I have one side of the association managed by Hibernate and the other side managed separately (e.g., code that accesses LDAP directly)?"
I was assuming that the answer to the first question was "yes," but my code does not work and I was wondering if I was doing something wrong. I have two *.cfg.xml files that point to the two schemas.
ldap.cfg.xml
<mapping resource="com/acltd/madrigal/hibernate/Ldapuserinfo.hbm.xml"/>
hibernate.cfg.xml
<mapping resource="com/acltd/madrigal/hibernate/Sysservice.hbm.xml"/>
I use two session factories
ldapSessionFactory = cfg.configure("/ldap.cfg.xml").buildSessionFactory();
madrigalSessionFactory = cfg.configure().buildSessionFactory();
When the code initializes, I get the following error. What am I doing wrong?
Thanks,
Vladimir
18:37:48,626 INFO [Environment] Hibernate 2.1.7
18:37:48,636 INFO [Environment] hibernate.properties not found
18:37:48,646 INFO [Environment] using CGLIB reflection optimizer
18:37:48,646 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
18:37:48,646 INFO [Configuration] configuring from resource: /ldap.cfg.xml
18:37:48,646 INFO [Configuration] Configuration resource: /ldap.cfg.xml
18:37:48,786 INFO [Configuration] Mapping resource: com/acltd/madrigal/hibernat
e/Ldapuserinfo.hbm.xml
18:37:48,986 INFO [Binder] Mapping class: com.acltd.madrigal.hibernate.Ldapuserinfo -> LDAPUSERINFO
18:37:49,247 INFO [Binder] Mapping collection: com.acltd.madrigal.hibernate.Ldapuserinfo.sysprivs -> SYSUSERPRIV
18:37:49,247 INFO [Configuration] Configured SessionFactory: java:/hibernate/HibernateFactory
18:37:49,247 INFO [Configuration] processing one-to-many association mappings
18:37:49,257 INFO [STDOUT] net.sf.hibernate.MappingException: Association references unmapped class: com.acltd.madrigal.hibernate.Sysservice
|