This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Generation & execution DDL schema Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Generation & execution DDL schema" Watch "Generation & execution DDL schema" New topic
Author

Generation & execution DDL schema

Paul Savostin
Greenhorn

Joined: Nov 23, 2012
Posts: 4
Hi, everyone! need help in the next issue:

there are 2 annotated classes :
first:


second:


I'm trying to generate a ddl schema using org.hibernate.tool.hbm2ddl.SchemaExport class, example :
example

first all turns fine - by maven I compile classes, then run through exec-maven-plugin main method SchemaGenerator and getting folowing schema:


As you can see at first is a record "alter table TRACK drop constraint FK4C5F92B15F7E587;" naturally when i trying to run this scheme by sql-maven-plugin occurs following:

1) when i execute only one goal such " mvn sql:execute " i'm getting :
---sql-maven-plugin:1.5:execute <default-cli> @ test3-proj --- 0 of 0 SQL statements executed successfully

No errors, but nothing happens and schema don't create tables

2)when join this goal to all build and execute " mvn package "

[ERROR] Failed to execute goal org.codehaus.mojo:sql-maven-plugin:1.5:execute (c
reate-database) on project test3-proj: user lacks privilege or object not found:
FK4C5F92B15F7E587 -> [Help 1]

If i delete first record in created schema alter table TRACK drop constraint FK4C5F92B15F7E587; with option 2) all works out fine!

So, are there any solutions on this? why SchemaGenerator class generates this unnecessary record ? how to get rid of it ?

thanks in advance



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Generation & execution DDL schema
 
Similar Threads
NullPointerException when creating a many-to-may relationship
No error/exception in log on insert yet no row inserted to db
Regarding Foreign Key Restricts when Alter data type in sql table
Question about the type of JoinColumn.
JPA data retrieval query