max wrote:
<type-mapping sql-type="CHAR" length="2" hibernate-type="string"/>
This can't be parsed, so I put this :
Code:
<hibernate-reverse-engineering>
<type-mapping>
<sql-type jdbc-type="CHAR" length="2" hibernate-type="string"/>
</type-mapping>
</hibernate-reverse-engineering>
and got this error:
Code:
13:49:31,397 INFO [TableMetadata] table found: configuration.userdb_domain_acl
13:49:31,397 INFO [TableMetadata] columns: [id, enabled, tablename, domain]
13:49:31,397 WARN [ServiceController] Problem starting service persistence.units:ear=msmgui.ear,unitName=msmgui
javax.persistence.PersistenceException: org.hibernate.HibernateException: Wrong column type: enabled, expected: varchar(
2)
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)
Property in bean looks like this:
Code:
@Column(name = "enabled", length = 2)
@Length(max = 2)
public String getEnabled() {
return this.enabled;
}
I also tried this to check is column matched correctly:
reveng.xml:Code:
<type-mapping>
<sql-type jdbc-type="CHAR" length="2" hibernate-type="long"/>
</type-mapping>
bean:Code:
@Column(name = "enabled", length = 2)
@Length(max = 2)
public long getEnabled() {
return this.enabled;
}
error:Code:
14:49:16,469 INFO [TableMetadata] table found: configuration.userdb_domain_acl
14:49:16,469 INFO [TableMetadata] columns: [id, enabled, tablename, domain]
14:49:16,469 WARN [ServiceController] Problem starting service persistence.units:ear=msmgui.ear,unitName=msmgui
javax.persistence.PersistenceException: org.hibernate.HibernateException: Wrong column type: enabled, expected: bigint
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:698)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
Funny thing, regular char columns work fine.
I don't know enough about Hibernate internals to pinpoint problem.
I have one suggestion, though: exception should state not just expected type, but also received. That will make analysis easier.