Hello,
I'm having trouble deploying objects containing one-to-one associations. I've used one-to-many(collection) types of assocation with no fuss, this is a first time i'm playing with one-to-one ones.
Having the following xdoclet in my object works just fine. Not he use of class = "fi.jab.poc.Role" which causes no problem.
Code:
/**
* @hibernate.set order-by = "role_id" cascade = "all"
* @hibernate.collection-key column = "user_id"
* @hibernate.collection-one-to-many class = "fi.jab.poc.Role"
*/
public Collection getRoles() {
return roles;
}
But when i'm trying to use the same class (which is also Hibernated object) with one-to-one i've to make it implement Serializable otherwise there'll be some deployment time exceptions thrown from Binder.getTypeFromXML-method.
Here's the xdoclet configuration for the offending part:
Code:
/**
* @return
* @hibernate.property
* @hibernate.one-to-one
*/
public Person getPerson() {
return person;
}
Code:
17:11:10,011 INFO [Binder] Mapping class: fi.jab.poc.LogItem -> JAB_LOGITEM
17:11:42,668 ERROR [Configuration] Could not compile the mapping document
net.sf.hibernate.MappingException: Could not interpret type: fi.jab.poc.Person
at net.sf.hibernate.cfg.Binder.getTypeFromXML(Binder.java:788)
at net.sf.hibernate.cfg.Binder.bindValue(Binder.java:354)
at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:891)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:294)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273)
at net.sf.hibernate.jmx.HibernateService.buildSessionFactory(HibernateService.java:160)
at net.sf.hibernate.jmx.HibernateService.start(HibernateService.java:131)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
at $Proxy14.start(Unknown Source)
Maybe i'm just missing something, can someone point me to proper documentation/examples?
Or is it neccaccery for one-to-one referenced object to be either serializable or one of the other types mentioned in TypeFactory.hueristicType (maybe a typo?)?