MappingException: Repeated column in mapping for entity w/SI
lpmon Jan 8, 2008 9:47 PMJBoss 4.0.5.GA w/EJB3 and Hibernate 3.2.3.ga (I think this is Hibernate version )
I am trying to use entity inheritance. I have followed JBoss examples.
If I don't put updatable=false, insertable=false on the discriminator column I get this error at deployment time:
19:04:43,113 WARN [ServiceController] Problem starting service persistence.units:ear=mixseam.ear,jar=mixseam.jar,unitName=mixseam
javax.persistence.PersistenceException: org.hibernate.MappingException: Repeated column in mapping for entity: com.moretolike.ejb3.entity.VideoTrack column: trackType (should be mapped with insert="false" update="false")
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:698)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
....
....
Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: com.moretolike.ejb3.entity.VideoTrack column: trackType (should be mapped with insert="false" update="false")
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:652)
at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:674)
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:696)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:450)
at org.hibernate.mapping.SingleTableSubclass.validate(SingleTableSubclass.java:43)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1102)
If use: updatable=true, insertable=true I get this error on an insert:
20:43:29,020 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: 22001
20:43:29,020 ERROR [JDBCExceptionReporter] Data truncation: Data too long for column 'trackType' at row 1
20:43:29,020 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
org.hibernate.exception.DataException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:77)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
I am guessing that I really need updatable and insertable as true and when false it yields this last error. What is the deal here? I am following examples. Is there a bug related to this?