Problem auto creating table
gvalenc Nov 17, 2010 6:46 PMI'm getting these errors while deploying a bean that has a persistence unit (edited names of classes, fields):
15:00:33,417 INFO [PersistenceUnitDeployment] Starting persistence unit persistence.unit:unitName=MyApp.ear/myapp_director.jar#MyApp
15:00:33,417 INFO [Ejb3Configuration] Processing PersistenceUnitInfo [
name: MyApp
...]
15:00:33,417 WARN [Ejb3Configuration] Persistence provider caller does not implement the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is null.
15:00:33,448 WARN [EJB3OverridenAnnotationReader] Property xyz1._1234URN not found in class but described in <mapping-file/> (possible typo error)
15:00:33,448 WARN [EJB3OverridenAnnotationReader] Property xyz2._id not found in class but described in <mapping-file/> (possible typo error)
15:00:33,448 WARN [EJB3OverridenAnnotationReader] Property xyz2._****Locator not found in class but described in <mapping-file/> (possible typo error)
15:00:33,448 WARN [EJB3OverridenAnnotationReader] Property xyz2._ABCDID not found in class but described in <mapping-file/> (possible typo error)
15:00:33,448 WARN [EJB3OverridenAnnotationReader] Property xyz3._5678Name not found in class but described in <mapping-file/> (possible typo error)
15:00:33,448 INFO [AnnotationBinder] Binding entity from annotated class: xyz2
15:00:33,448 INFO [EntityBinder] Bind entity xyz2 on table ****_TABLE
15:00:33,464 INFO [AnnotationBinder] Binding entity from annotated class: xyz1
15:00:33,464 INFO [AnnotationBinder] Binding entity from annotated class: xyz3
15:00:33,495 INFO [HibernateSearchEventListenerRegister] Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
15:00:33,495 INFO [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
15:00:33,495 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
15:00:33,495 INFO [SettingsFactory] RDBMS: HSQL Database Engine, version: 1.8.0
15:00:33,495 INFO [SettingsFactory] JDBC driver: HSQL Database Engine Driver, version: 1.8.0
15:00:33,495 INFO [Dialect] Using dialect: org.hibernate.dialect.HSQLDialect
15:00:33,495 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.ejb.transaction.JoinableCMTTransactionFactory
15:00:33,495 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
15:00:33,495 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
15:00:33,495 INFO [SettingsFactory] Automatic flush during beforeCompletion(): disabled
15:00:33,495 INFO [SettingsFactory] Automatic session close at end of transaction: disabled
15:00:33,495 INFO [SettingsFactory] JDBC batch size: 15
15:00:33,495 INFO [SettingsFactory] JDBC batch updates for versioned data: disabled
15:00:33,495 INFO [SettingsFactory] Scrollable result sets: enabled
15:00:33,495 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): disabled
15:00:33,495 INFO [SettingsFactory] Connection release mode: auto
15:00:33,495 INFO [SettingsFactory] Default batch fetch size: 1
15:00:33,495 INFO [SettingsFactory] Generate SQL with comments: disabled
15:00:33,495 INFO [SettingsFactory] Order SQL updates by primary key: disabled
15:00:33,495 INFO [SettingsFactory] Order SQL inserts for batching: disabled
15:00:33,495 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
15:00:33,495 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
15:00:33,495 INFO [SettingsFactory] Query language substitutions: {}
15:00:33,495 INFO [SettingsFactory] JPA-QL strict compliance: enabled
15:00:33,495 INFO [SettingsFactory] Second-level cache: enabled
15:00:33,495 INFO [SettingsFactory] Query cache: disabled
15:00:33,495 INFO [SettingsFactory] Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge
15:00:33,495 INFO [RegionFactoryCacheProviderBridge] Cache provider: org.hibernate.cache.HashtableCacheProvider
15:00:33,495 INFO [SettingsFactory] Optimize cache for minimal puts: disabled
15:00:33,495 INFO [SettingsFactory] Cache region prefix: persistence.unit:unitName=MyApp.ear/myapp_director.jar#MyApp
15:00:33,495 INFO [SettingsFactory] Structured second-level cache entries: disabled
15:00:33,495 INFO [SettingsFactory] Statistics: disabled
15:00:33,495 INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
15:00:33,495 INFO [SettingsFactory] Default entity-mode: pojo
15:00:33,495 INFO [SettingsFactory] Named query checking : enabled
15:00:33,511 INFO [SessionFactoryImpl] building session factory
15:00:33,526 INFO [SessionFactoryObjectFactory] Factory name: persistence.unit:unitName=MyApp.ear/myapp_director.jar#MyApp
15:00:33,526 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
15:00:33,620 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: persistence.unit:unitName=MyApp.ear/myapp_director.jar#MyApp
15:00:33,620 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext
15:00:33,636 INFO [SchemaExport] Running hbm2ddl schema export
15:00:33,636 INFO [SchemaExport] exporting generated schema to database
15:00:33,636 ERROR [SchemaExport] Unsuccessful: create table ****_TABLE (DTYPE varchar(31) not null, ****_ID varchar generated by default as identity (start with 1), ABCD_ID varchar(255), ****_LOCATOR longvarbinary, 1234_URN varchar(255), 5678_NAME varchar(255), primary key (****_ID))
15:00:33,651 ERROR [SchemaExport] Wrong data type: ****_ID in statement [create table ****_TABLE (DTYPE varchar(31) not null, ****_ID varchar generated by default as identity (start with 1)]
15:00:33,651 INFO [SchemaExport] schema export complete
This is my orm.xml:
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"
version="1.0">
<entity class="xyz2" access="FIELD">
<table name="****_TABLE"/>
<inheritance strategy="SINGLE_TABLE"/>
<attributes>
<id name="_id">
<column name="****_ID" nullable="false" column-definition="varchar"/>
<generated-value strategy="AUTO"/>
</id>
<basic name="_****Locator">
<column name="****_LOCATOR"/>
<lob/>
</basic>
<basic name="_ABCDID">
<column name="ABCD_ID"/>
</basic>
</attributes>
</entity>
<entity class="xyz1" access="FIELD">
<attributes>
<basic name="_1234URN">
<column name="1234_URN"/>
</basic>
</attributes>
</entity>
<entity class="xyz3" access="FIELD">
<attributes>
<basic name="_5678Name">
<column name="5678_NAME"/>
</basic>
</attributes>
</entity>
</entity-mappings>
{code}
This is my persistence.xml:
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="MyApp">
<jta-data-source>java:/MyAppDataSource</jta-data-source>
<class>xyz2</class>
<class>xyz1</class>
<class>xyz3</class>
<class>xyz4</class>
<exclude-unlisted-classes/>
<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
</properties>
</persistence-unit>
</persistence>
{code}
I haven't found anything that says we can't use varchar for the primary key. Is there something else I'm missing?
This is on 5.1.0 GA and I'm not using any JPA annotations, only XML.