I did a search of the forums and couldn't find anyone else that asked this question, which I found unusual since I would think it would be a pretty common problem.
I am using net.sf.hibernate.tool.hbm2ddl.SchemaExportTask with ant in an attempt to generate DDL.
I have been playing around with this for a little while and I am able to generate DDL using the following Dialects:
MySQLDialect
DB2Dialect
SQLServerDialect
However, when I attempt to generate DDL off of OracleDialect I get the following error:
C:\Jdev\9.0.5.2Location of the build file\build.xml:159: Schema text failed: Dialect does not support identity key generation
I assume that this is because Oracle does not have auto incrementation. However, if this is what is causing the problem, what is a good work around?
The project that I am working on requires me to be able to run the SchemaExportTask on my mapping file using all 4 of the Dialects listed above, without modifications to the mapping file between running SchemeExportTask with the various Dialects. Is this possible?
If this is not possible, what changes do I need to make to my mapping document in order to make hbm2ddl function with Oracle that would then need to be undone to make it function with the other 3?
If you need more information in order to troubleshoot my problem I would be more than happy to provide it. Please let me know.
Thanks for any help you can provide!
Hibernate version:
Hibernate 2.0
Mapping documents:
<id name="id" type="long" unsaved-value="null">
<column name="sync_id" sql-type="integer" not-null="true" />
<generator class="identity" />
</id>
Log of the failed attempt:
Buildfile: build.xml
schema:
[schemaexport] 0 [main] INFO hibernate.cfg.Environment - Hibernate 2.1.1
[schemaexport]
[schemaexport] 50 [main] INFO hibernate.cfg.Environment - loaded properties
from resource hibernate.properties: {hibernate.connection.username=cmarkiewicz,
hibernate.connection.password=password, hibernate.cglib.use_reflection_optimizer
=true, hibernate.dialect=net.sf.hibernate.dialect.OracleDialect, hibernate.conne
ction.url=jdbc:mysql://172.31.17.22:3306/ods_huber, hibernate.connection.driver_
class=com.mysql.jdbc.Driver}
[schemaexport]
[schemaexport] 110 [main] INFO hibernate.cfg.Environment - using CGLIB reflec
tion optimizer
[schemaexport]
[schemaexport] 331 [main] INFO hibernate.cfg.Configuration - Mapping file: C:
\Jdev\9.0.5.2\jdev\mywork\Salesforce_Datamart\salesforce_datamart_partnerAPI\cla
sses\sfdatamart_mapping.xml
[schemaexport]
[schemaexport] 2644 [main] INFO hibernate.cfg.Binder - Mapping class: com.ci.d
b.member.SyncTimes -> sync_times
[schemaexport]
[schemaexport] 3435 [main] INFO hibernate.cfg.Binder - Mapping class: com.ci.d
b.member.AccountBean -> account_sf
This pattern continues for every object in the mapping document, as is to be expected
[schemaexport] 6590 [main] INFO hibernate.cfg.Binder - Mapping class: com.ci.d
b.member.UserRoleBean -> userrole_sf
[schemaexport]
[schemaexport] 6620 [main] INFO hibernate.cfg.Binder - Mapping class: com.ci.d
b.member.UserTeamMemberBean -> userteammember_sf
[schemaexport]
[schemaexport] 6790 [main] INFO hibernate.dialect.Dialect - Using dialect: net
.sf.hibernate.dialect.OracleDialect
[schemaexport]
[schemaexport] 6820 [main] INFO hibernate.cfg.Configuration - processing one-t
o-many association mappings
[schemaexport]
[schemaexport] 6820 [main] INFO hibernate.cfg.Configuration - processing one-t
o-one association property references
[schemaexport]
[schemaexport] 6820 [main] INFO hibernate.cfg.Configuration - processing forei
gn key constraints
[schemaexport]
[schemaexport] 7140 [main] INFO hibernate.cfg.Configuration - processing one-t
o-many association mappings
[schemaexport]
[schemaexport] 7140 [main] INFO hibernate.cfg.Configuration - processing one-t
o-one association property references
[schemaexport]
[schemaexport] 7140 [main] INFO hibernate.cfg.Configuration - processing forei
gn key constraints
[schemaexport]
BUILD FAILED
C:\Jdev\9.0.5.2Location of the build file\build.xml:159: Schema text failed: Dialect does not support identity key generation
|