You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Thomas Polliard <th...@polliard.com> on 2009/11/24 04:50:20 UTC

Schema wont create

polliard@helium: ant 
Buildfile: build.xml

init:
    [mkdir] Created dir: /Users/polliard/Workspace/iCloud/build
    [mkdir] Created dir: /Users/polliard/Workspace/iCloud/build/schema
    [mkdir] Created dir: /Users/polliard/Workspace/iCloud/build/META-INF
     [copy] Copying 1 file to /Users/polliard/Workspace/iCloud/build/META-INF

compile:
    [javac] Compiling 3 source files to /Users/polliard/Workspace/iCloud/build

BUILD SUCCESSFUL
Total time: 0 seconds

=====
polliard@helium: ant enhance
Buildfile: build.xml

init:

compile:

enhance:
     [echo] Enhancer Start
 [enhancer] 242  icloud  INFO   [main] openjpa.Tool - No targets were given.  Running on all classes in your persistent classes list, or all metadata files in classpath directories if you have not listed your persistent classes.  Use -help to display tool usage information.
 [enhancer] 361  icloud  INFO   [main] openjpa.Enhance - Enhancing type "class com.trukoda.icloud.Author".
 [enhancer] 409  icloud  INFO   [main] openjpa.Enhance - Enhancing type "class com.trukoda.icloud.Tag".
 [enhancer] 437  icloud  INFO   [main] openjpa.Enhance - Enhancing type "class com.trukoda.icloud.Article".
     [echo] Enhancer Completed

BUILD SUCCESSFUL
Total time: 0 seconds

========
polliard@helium: export CLASSPATH=.:/Users/polliard/Library/Java/openjpa/2.0-M3/openjpa-all-2.0.0-M3.jar:/Users/polliard/Library/Java/hsqldb/1.8.1.1/hsqldb-1.8.1.1.jar 
[~/Workspace/iCloud/build]
polliard@helium: java org.apache.openjpa.jdbc.schema.SchemaTool -a createDB -f stdout
55  icloud  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.HSQLDictionary".
402  icloud  INFO   [main] openjpa.Tool - Schema tool running action "createDB".  This process may take some time.  Enable the org.apache.openjpa.jdbc.Schema logging category to see messages about the collection of schema data, and the org.apache.openjpa.jdbc.SQL category to see generated SQL commands.
909  icloud  INFO   [main] openjpa.Tool - Recording schema changes.


Yet no output and the database has no tables.  Any ideas?


Re: Schema wont create

Posted by Thomas Polliard <th...@polliard.com>.
Ok,  So it seems that I was using the wrong tool.  Sorry for the post.

I was using SchemaTool instead of MappingTool.

Thomas
On Nov 24, 2009, at 1:11 AM, Thomas Polliard wrote:

> Interesting, all the tales are null :(
> 
> 
> [schematool] 340  icloud  TRACE  [main] openjpa.jdbc.JDBC - Initial connection autoCommit: true, holdability: 1, TransactionIsolation: 2
> [schematool] 448  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 1573788650> [106 ms] close
> [schematool] 453  icloud  INFO   [main] openjpa.Tool - Schema tool running action "createDB".  This process may take some time.  Enable the org.apache.openjpa.jdbc.Schema logging category to see messages about the collection of schema data, and the org.apache.openjpa.jdbc.SQL category to see generated SQL commands.
> [schematool] 470  icloud  TRACE  [main] openjpa.jdbc.Schema - Reading table information for schema name "null", table name "null".
> [schematool] 470  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 1141024511> getColumns: null, null, null, null
> [schematool] 509  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 1141024511> getTables: null, null, null
> [schematool] 516  icloud  TRACE  [main] openjpa.jdbc.Schema - Reading sequence information for schema "null", sequence name "null".
> [schematool] 520  icloud  TRACE  [main] openjpa.jdbc.SQL - <t 1486975107, conn 1141024511> executing prepstmnt 1623810826 SELECT SEQUENCE_SCHEMA, SEQUENCE_NAME FROM INFORMATION_SCHEMA.SYSTEM_SEQUENCES
> [schematool] 521  icloud  TRACE  [main] openjpa.jdbc.SQL - <t 1486975107, conn 1141024511> [0 ms] spent
> [schematool] 523  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 1141024511> [0 ms] commit
> [schematool] 627  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 1141024511> [104 ms] close
> [schematool] 636  icloud  TRACE  [main] openjpa.jdbc.Schema - Reading primary keys for schema name "null", table name "null".
> [schematool] 636  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 245022965> getPrimaryKeys: null, null, null
> [schematool] 639  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 245022965> [0 ms] commit
> [schematool] 742  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 245022965> [103 ms] close
> [schematool] 750  icloud  TRACE  [main] openjpa.jdbc.Schema - Reading indexes for schema name "null", table name "null".
> [schematool] 750  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 103285717> getIndexInfo: null, null, null
> [schematool] 751  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 103285717> [0 ms] commit
> [schematool] 854  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 103285717> [103 ms] close
> [schematool] 860  icloud  TRACE  [main] openjpa.jdbc.Schema - Reading foreign keys for schema name "null", table name "null".
> [schematool] 860  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 1563063257> [0 ms] commit
> [schematool] 964  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 1563063257> [102 ms] close
> [schematool] 964  icloud  INFO   [main] openjpa.Tool - Recording schema changes.
> 
> 
> Any ideas why?
> 


Re: Schema wont create

Posted by Thomas Polliard <th...@polliard.com>.
Interesting, all the tales are null :(


[schematool] 340  icloud  TRACE  [main] openjpa.jdbc.JDBC - Initial connection autoCommit: true, holdability: 1, TransactionIsolation: 2
[schematool] 448  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 1573788650> [106 ms] close
[schematool] 453  icloud  INFO   [main] openjpa.Tool - Schema tool running action "createDB".  This process may take some time.  Enable the org.apache.openjpa.jdbc.Schema logging category to see messages about the collection of schema data, and the org.apache.openjpa.jdbc.SQL category to see generated SQL commands.
[schematool] 470  icloud  TRACE  [main] openjpa.jdbc.Schema - Reading table information for schema name "null", table name "null".
[schematool] 470  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 1141024511> getColumns: null, null, null, null
[schematool] 509  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 1141024511> getTables: null, null, null
[schematool] 516  icloud  TRACE  [main] openjpa.jdbc.Schema - Reading sequence information for schema "null", sequence name "null".
[schematool] 520  icloud  TRACE  [main] openjpa.jdbc.SQL - <t 1486975107, conn 1141024511> executing prepstmnt 1623810826 SELECT SEQUENCE_SCHEMA, SEQUENCE_NAME FROM INFORMATION_SCHEMA.SYSTEM_SEQUENCES
[schematool] 521  icloud  TRACE  [main] openjpa.jdbc.SQL - <t 1486975107, conn 1141024511> [0 ms] spent
[schematool] 523  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 1141024511> [0 ms] commit
[schematool] 627  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 1141024511> [104 ms] close
[schematool] 636  icloud  TRACE  [main] openjpa.jdbc.Schema - Reading primary keys for schema name "null", table name "null".
[schematool] 636  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 245022965> getPrimaryKeys: null, null, null
[schematool] 639  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 245022965> [0 ms] commit
[schematool] 742  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 245022965> [103 ms] close
[schematool] 750  icloud  TRACE  [main] openjpa.jdbc.Schema - Reading indexes for schema name "null", table name "null".
[schematool] 750  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 103285717> getIndexInfo: null, null, null
[schematool] 751  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 103285717> [0 ms] commit
[schematool] 854  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 103285717> [103 ms] close
[schematool] 860  icloud  TRACE  [main] openjpa.jdbc.Schema - Reading foreign keys for schema name "null", table name "null".
[schematool] 860  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 1563063257> [0 ms] commit
[schematool] 964  icloud  TRACE  [main] openjpa.jdbc.JDBC - <t 1486975107, conn 1563063257> [102 ms] close
[schematool] 964  icloud  INFO   [main] openjpa.Tool - Recording schema changes.


Any ideas why?


Re: Schema wont create

Posted by Thomas Polliard <th...@polliard.com>.
Im using a different database and Im using process based database.  Other then that I don't see a difference.
On Nov 24, 2009, at 12:40 AM, crispyoz [via OpenJPA] wrote:

> Your properties look different to mine: 
> 
>                         <property name="openjpa.ConnectionDriverName" 
> value="com.mysql.jdbc.Driver" /> 
>                         <property name="openjpa.ConnectionURL" 
> value="jdbc:mysql://localhost:3306/trm" /> 
>                         <property name="openjpa.ConnectionUserName" 
> value="root" /> 
>                         <property name="openjpa.ConnectionPassword" 
> value="password" /> 
>                         <property name="openjpa.jdbc.SynchronizeMappings" 
> value="buildSchema(ForeignKeys=true)" /> 
>   <property name="openjpa.Log" 
> value="DefaultLevel=ERROR, Tool=ERROR" /> 
> 
> -----Original Message----- 
> From: Thomas Polliard [mailto:[hidden email]] 
> Sent: Tuesday, 24 November 2009 3:54 PM 
> To: [hidden email] 
> Subject: RE: Schema wont create 
> 
> 
> Here is my persistence.xml.  Yes the classes are specified. 
> 
> <?xml version="1.0" encoding="UTF-8"?> 
> <persistence version="1.0" 
>                          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"> 
>         <persistence-unit name="icloud"> 
>                 
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> 
>                 
>                 <class>com.trukoda.icloud.Article</class> 
>                 <class>com.trukoda.icloud.Author</class> 
>                 <class>com.trukoda.icloud.Tag</class> 
>                 
>                 <properties> 
>                         <property name="openjpa.ConnectionUserName" 
> value="SA"/> 
>                         <property name="openjpa.ConnectionPassword" 
> value=""/> 
>                         <property name="openjpa.ConnectionURL" 
> value="jdbc:hsqldb:file:/Users/polliard/Workspace/iCloud/build/db/personal;s 
> hutdown=true"/> 
>                         <property name="openjpa.ConnectionDriverName" 
> value="org.hsqldb.jdbcDriver"/> 
>                         <property name="openjpa.ConnectionFactoryProperties" 
>                                 value="PrettyPrint=true, 
> PrettyPrintLineLength=80"/> 
>                         <property name="openjpa.jdbc.SynchronizeMappings" 
> value="buildSchema(ForeignKeys=true)"/> 
>                                 
>                 </properties> 
>         </persistence-unit> 
> </persistence> 
> -- 
> View this message in context: 
> http://n2.nabble.com/Schema-wont-create-tp4055690p4055866.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com. 
> 
> 
> 
> View message @ http://n2.nabble.com/Schema-wont-create-tp4055690p4055973.html 
> To unsubscribe from RE: Schema wont create, click here.
> 


-- 
View this message in context: http://n2.nabble.com/Schema-wont-create-tp4055690p4055979.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

RE: Schema wont create

Posted by C N Davies <cn...@cndavies.com>.
Your properties look different to mine:

			<property name="openjpa.ConnectionDriverName"
value="com.mysql.jdbc.Driver" />
			<property name="openjpa.ConnectionURL"
value="jdbc:mysql://localhost:3306/trm" />
			<property name="openjpa.ConnectionUserName"
value="root" />
			<property name="openjpa.ConnectionPassword"
value="password" />
			<property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)" /> 
  			<property name="openjpa.Log"
value="DefaultLevel=ERROR, Tool=ERROR" />

-----Original Message-----
From: Thomas Polliard [mailto:thomas@polliard.com] 
Sent: Tuesday, 24 November 2009 3:54 PM
To: users@openjpa.apache.org
Subject: RE: Schema wont create


Here is my persistence.xml.  Yes the classes are specified.

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" 
			 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">
        <persistence-unit name="icloud">
               
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
                
                <class>com.trukoda.icloud.Article</class>
                <class>com.trukoda.icloud.Author</class>
                <class>com.trukoda.icloud.Tag</class>
                
                <properties>
                        <property name="openjpa.ConnectionUserName"
value="SA"/>
                        <property name="openjpa.ConnectionPassword"
value=""/>
                        <property name="openjpa.ConnectionURL"
value="jdbc:hsqldb:file:/Users/polliard/Workspace/iCloud/build/db/personal;s
hutdown=true"/>
                        <property name="openjpa.ConnectionDriverName"
value="org.hsqldb.jdbcDriver"/>
                        <property name="openjpa.ConnectionFactoryProperties"
                                value="PrettyPrint=true,
PrettyPrintLineLength=80"/>
                        <property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)"/>
                                
                </properties>
        </persistence-unit>
</persistence>
-- 
View this message in context:
http://n2.nabble.com/Schema-wont-create-tp4055690p4055866.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


RE: Schema wont create

Posted by Thomas Polliard <th...@polliard.com>.
Here is my persistence.xml.  Yes the classes are specified.

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" 
			 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">
        <persistence-unit name="icloud">
               
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
                
                <class>com.trukoda.icloud.Article</class>
                <class>com.trukoda.icloud.Author</class>
                <class>com.trukoda.icloud.Tag</class>
                
                <properties>
                        <property name="openjpa.ConnectionUserName"
value="SA"/>
                        <property name="openjpa.ConnectionPassword"
value=""/>
                        <property name="openjpa.ConnectionURL"
value="jdbc:hsqldb:file:/Users/polliard/Workspace/iCloud/build/db/personal;shutdown=true"/>
                        <property name="openjpa.ConnectionDriverName"
value="org.hsqldb.jdbcDriver"/>
                        <property name="openjpa.ConnectionFactoryProperties"
                                value="PrettyPrint=true,
PrettyPrintLineLength=80"/>
                        <property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)"/>
                                
                </properties>
        </persistence-unit>
</persistence>
-- 
View this message in context: http://n2.nabble.com/Schema-wont-create-tp4055690p4055866.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

RE: Schema wont create

Posted by C N Davies <cn...@cndavies.com>.
Did you add the type to your persistence.xml?

Also you need to set the property:

<property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)" />

Hth

Chris

-----Original Message-----
From: Thomas Polliard [mailto:thomas@polliard.com] 
Sent: Tuesday, 24 November 2009 3:42 PM
To: users@openjpa.apache.org
Subject: Re: Schema wont create


The files do have persisted fields:

@Entity
public class Article {
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private int id = -1;
	
	@ManyToOne(cascade=CascadeType.ALL)
	private Author author = null;
	
	@Basic
	private String title = null;
	
	@Basic
	private String content = null;
	
	@ManyToMany(cascade=CascadeType.ALL)
	private List<Tag> tags = new ArrayList<Tag>();
	.....

-- 
View this message in context:
http://n2.nabble.com/Schema-wont-create-tp4055690p4055835.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Schema wont create

Posted by Thomas Polliard <th...@polliard.com>.
The files do have persisted fields:

@Entity
public class Article {
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private int id = -1;
	
	@ManyToOne(cascade=CascadeType.ALL)
	private Author author = null;
	
	@Basic
	private String title = null;
	
	@Basic
	private String content = null;
	
	@ManyToMany(cascade=CascadeType.ALL)
	private List<Tag> tags = new ArrayList<Tag>();
	.....

-- 
View this message in context: http://n2.nabble.com/Schema-wont-create-tp4055690p4055835.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.