-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: hbm2ddl: error in preparing database. using ant.
PostPosted: Tue May 10, 2005 4:46 am 
Newbie

Joined: Wed Mar 16, 2005 9:39 am
Posts: 5

I am using ant build script to gerneate database schema, the ant when use hibernate to connect to database. the connection could not happen,
the database.property file that i am using have the following elements.


#Hibernate Configuration for JUnit tests
#Tue May 10 09:41:18 GMT+05:30 2005
hibernate.connection.username=test
dao.type=hibernate
hibernate.connection.password=test
hibernate.cglib.use_reflection_optimizer=false
hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect
hibernate.connection.url=jdbc\:mysql\://localhost/DEW1?autoReconnect\=true&useUnicode\=true&characterEncoding\=utf-8
hibernate.connection.show_sql=true
hibernate.connection.driver_class=com.mysql.jdbc.Driver

can you please look whether this ant gerated file is not properly generated as you can see "\" in connection url. aur is the missing hebernate file that it is giving error.






Hibernate version:3.0

Mapping documents:

Full stack trace of any exception that occurs:[b]


OUTPUT ON CONSOLE:

Buildfile: E:\eclipse30\eclipse\workspace\prototype\build.xml
[echo] in property file database type mysql
[echo] database host localhost
[echo] database name DEW1
[echo] database url jdbc:mysql://localhost:3306/prototype2?autoReconnect=true
init:
db-create:
[echo] Detected MySQL, creating database...
[echo] Creating database with: mysql-create.sql
[echo] URL: jdbc:mysql://localhost/mysql
[echo] Username: root
[echo] Password:
[sql] Executing file: E:\eclipse30\eclipse\workspace\prototype\metadata\sql\mysql-create.sql
[sql] 3 of 3 SQL statements executed successfully
clean:
[echo] Cleaning build and distribution directories
[delete] Deleting directory E:\eclipse30\eclipse\workspace\prototype\build
[delete] Deleting directory E:\eclipse30\eclipse\workspace\prototype\dist
[delete] Deleting: E:\eclipse30\eclipse\workspace\prototype\database.properties
build.properties.missing:
prepare:
[echo] Preparing target directory 'E:\eclipse30\eclipse\workspace\prototype/build/prototype2'
[mkdir] Created dir: E:\eclipse30\eclipse\workspace\prototype\build\prototype2
[mkdir] Created dir: E:\eclipse30\eclipse\workspace\prototype\build\prototype2\WEB-INF
[mkdir] Created dir: E:\eclipse30\eclipse\workspace\prototype\dist\webapps
hibernatedoclet:
[hibernatedoclet] May 9, 2005 5:28:44 PM xdoclet.XDocletMain start
[hibernatedoclet] INFO: Running <hibernate/>
[hibernatedoclet] Generating mapping file for org.appfuse.model.User.
[hibernatedoclet] org.appfuse.model.User
[hibernatedoclet] Generating mapping file for org.appfuse.model.UserCookie.
[hibernatedoclet] org.appfuse.model.UserCookie
[hibernatedoclet] Generating mapping file for org.appfuse.model.Role.
[hibernatedoclet] org.appfuse.model.Role
compile-dao:
[echo] in property file database type mysql
[echo] database host localhost
[echo] database name DEW1
[echo] database url jdbc:mysql://localhost:3306/prototype2?autoReconnect=true
compile-module:
[echo] Compiling dao...
[mkdir] Created dir: E:\eclipse30\eclipse\workspace\prototype\build\dao\classes
[mkdir] Created dir: E:\eclipse30\eclipse\workspace\prototype\build\test\dao\classes
[javac] Compiling 23 source files to E:\eclipse30\eclipse\workspace\prototype\build\dao\classes
[javac] Compiling 5 source files to E:\eclipse30\eclipse\workspace\prototype\build\test\dao\classes
package-dao:
[copy] Copying 3 files to E:\eclipse30\eclipse\workspace\prototype\build\dao\gen
[jar] Building jar: E:\eclipse30\eclipse\workspace\prototype\dist\prototype2-dao.jar
db-prepare:
[echo] in property file database type mysql
[echo] database host localhost
[echo] database name DEW1
[echo] database url jdbc:mysql:// localhost:3306/prototype2?autoReconnect=true
generate.database.properties:
[echo] generating database.properties from build.properties
[echo] before hibernate.connection.url database url jdbc:mysql:// localhost:3306/prototype2?autoReconnect=true
[propertyfile] Creating new property file: E:\eclipse30\eclipse\workspace\prototype\database.properties
[schemaexport] May 9, 2005 5:28:50 PM org.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: Hibernate 3.0
[schemaexport] May 9, 2005 5:28:50 PM org.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: hibernate.properties not found
[schemaexport] May 9, 2005 5:28:50 PM org.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: using CGLIB reflection optimizer
[schemaexport] May 9, 2005 5:28:50 PM org.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: using JDK 1.4 java.sql.Timestamp handling
[schemaexport] May 9, 2005 5:28:50 PM org.hibernate.cfg.Configuration addFile
[schemaexport] INFO: Mapping file: E:\eclipse30\eclipse\workspace\prototype\build\dao\gen\com\ma\prototype\model\Policy.hbm.xml
[schemaexport] May 9, 2005 5:28:50 PM org.hibernate.cfg.Configuration addFile
[schemaexport] SEVERE: Could not configure datastore from file: E:\eclipse30\eclipse\workspace\prototype\build\dao\gen\com\ma\prototype\model\Policy.hbm.xml
[schemaexport] org.dom4j.DocumentException: hibernate.sourceforge.net Nested exception: hibernate.sourceforge.net
[schemaexport] at org.dom4j.io.SAXReader.read(SAXReader.java:358)
[schemaexport] at org.dom4j.io.SAXReader.read(SAXReader.java:219)
[schemaexport] at org.hibernate.cfg.Configuration.addFile(Configuration.java:223)
[schemaexport] at org.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
[schemaexport] at org.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
[schemaexport] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[schemaexport] at org.apache.tools.ant.Task.perform(Task.java:364)
[schemaexport] at org.apache.tools.ant.Target.execute(Target.java:341)
[schemaexport] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[schemaexport] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[schemaexport] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:377)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
[schemaexport] Nested exception:
[schemaexport] java.net.UnknownHostException: hibernate.sourceforge.net
[schemaexport] at java.net.PlainSocketImpl.connect(Unknown Source)
[schemaexport] at java.net.Socket.connect(Unknown Source)
[schemaexport] at java.net.Socket.connect(Unknown Source)
[schemaexport] at sun.net.NetworkClient.doConnect(Unknown Source)
[schemaexport] at sun.net.www.http.HttpClient.openServer(Unknown Source)
[schemaexport] at sun.net.www.http.HttpClient.openServer(Unknown Source)
[schemaexport] at sun.net.www.http.HttpClient.<init>(Unknown Source)
[schemaexport] at sun.net.www.http.HttpClient.<init>(Unknown Source)
[schemaexport] at sun.net.www.http.HttpClient.New(Unknown Source)




[b]Name and version of the database you are using:mysql


The generated SQL (show_sql=true):


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 10, 2005 5:41 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the jdbc urls are not the same - are you sure you are using the correct hibernate.properties with the ant run ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 10, 2005 5:57 am 
Newbie

Joined: Wed Mar 16, 2005 9:39 am
Posts: 5
max wrote:
the jdbc urls are not the same - are you sure you are using the correct hibernate.properties with the ant run ?


sorry the the database.properties file is old and error logs were new. I was trying with changing the database name. yes i am sure that the file is correct.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 10, 2005 5:59 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
ah you are using hibernate 2 mapping files with hibernate 3.

read the migration guide and you will notice you need to use a different DTD. (but the mapping files is otherwise portable)

/max

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.