I'm trying to create a compositeusertype for an IP address I will store as a byte array in postgres. This is my first attempt at a user type, so I'm sure I'm just missing something obvious.
Let me simplify things a bit here and skip over some of the internals that were working just fine until I changed things from a plain class to a user type.
@Entity @Table(name = "Device") public class DeviceBean extends AbstractManagedEntity implements Device { ... private String name; private IpAddress ip; ..... }
public class IpAddress implements Comparable, CompositeUserType { private byte[] ip; private String[] propertyNames = {"ip"}; private Type[] propertyTypes = {BinaryType.INSTANCE};
@Override public String[] getPropertyNames() { return(propertyNames); }
@Override public Type[] getPropertyTypes() { return(propertyTypes); } // I implemented all the other required methods -- omitted for brevity.
@Override public boolean isMutable() { return false; }
}
At runtime, here's my problem: isMutable is taken that there should be a property 'mutable' in my class.
2012.11.01 12:24:31,384 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.persistenceunit."epicenter.ear#EPICenter": org.jboss.msc.service.StartException in service jboss.persistenceunit."epicenter.ear#EPICenter": Failed to start service at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_24] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_24] at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_24] Caused by: javax.persistence.PersistenceException: [PersistenceUnit: EPICenter] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1] ... 3 more Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.component.PojoComponentTuplizer] at org.hibernate.tuple.component.ComponentTuplizerFactory.constructTuplizer(ComponentTuplizerFactory.java:101) at org.hibernate.tuple.component.ComponentTuplizerFactory.constructDefaultTuplizer(ComponentTuplizerFactory.java:122) at org.hibernate.tuple.component.ComponentMetamodel.<init>(ComponentMetamodel.java:81) at org.hibernate.mapping.Component.buildType(Component.java:181) at org.hibernate.mapping.Component.getType(Component.java:174) at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:289) at org.hibernate.mapping.Property.isValid(Property.java:238) at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:468) at org.hibernate.mapping.RootClass.validate(RootClass.java:270) at org.hibernate.cfg.Configuration.validate(Configuration.java:1294) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1736) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905) ... 9 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.6.0_24] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [rt.jar:1.6.0_24] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [rt.jar:1.6.0_24] at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [rt.jar:1.6.0_24] at org.hibernate.tuple.component.ComponentTuplizerFactory.constructTuplizer(ComponentTuplizerFactory.java:98) ... 21 more Caused by: org.hibernate.PropertyNotFoundException: Could not find a setter for property mutable in class com.extremenetworks.epicenter.common.types.IpAddress at org.hibernate.property.BasicPropertyAccessor.createSetter(BasicPropertyAccessor.java:252) at org.hibernate.property.BasicPropertyAccessor.getSetter(BasicPropertyAccessor.java:245) at org.hibernate.mapping.Property.getSetter(Property.java:325) at org.hibernate.tuple.component.PojoComponentTuplizer.buildSetter(PojoComponentTuplizer.java:159) at org.hibernate.tuple.component.AbstractComponentTuplizer.<init>(AbstractComponentTuplizer.java:65) at org.hibernate.tuple.component.PojoComponentTuplizer.<init>(PojoComponentTuplizer.java:59) ... 26 more
|