-->
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.  [ 6 posts ] 
Author Message
 Post subject: exporting schema to database
PostPosted: Mon Feb 09, 2004 6:58 am 
Beginner
Beginner

Joined: Mon Feb 09, 2004 6:49 am
Posts: 21
here is schemaexport target in my buildfile

<target name="schemaexport">
<path id="class.path">
<fileset dir="C:/Programfiler/hibernate-2.1">
<include name="**/*.jar" />
</fileset>
<pathelement location="${properties.dir}/bin" />
<fileset dir="${mysql.lib.home}">
<include name="**/*.jar" />
<include name="**/*.zip" />
</fileset>
</path>
<taskdef name="schemaexport"
classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask" classpathref="class.path" />

<schemaexport properties="hibernate.properties" quiet="no" text="yes" drop="no" delimiter=";"
output="${basedir}/schema-export.sql">

<fileset dir="bin">
<include name="**/*.hbm.xml" />
</fileset>
</schemaexport>
</target>

The schema-export.sql file is created without errors ,but no tables are created in my database.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 09, 2004 7:03 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
http://www.hibernate.org/hib_docs/reference/html/toolsetguide.html#toolsetguide-s1-5 text=yes means don't export to the database.


Top
 Profile  
 
 Post subject: done that
PostPosted: Mon Feb 09, 2004 7:08 am 
Beginner
Beginner

Joined: Mon Feb 09, 2004 6:49 am
Posts: 21
thx
but the only thing that happend was that the schema-export.sql file is now blank


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 09, 2004 9:03 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Is there any log output? Are your properties set up correctly?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 09, 2004 10:13 am 
Beginner
Beginner

Joined: Mon Feb 09, 2004 6:49 am
Posts: 21
I have no log output
hibernate.properties file:


#define query langugage constants/function names
hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'

##PLATFORM
#MySQL

## JNDI Datasource

#hibernate.connection.datasource jdbc/quickstart

hibernate.dialect net.sf.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class org.gjt.mm.mysql.Driver
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.connection.url jdbc:mysql:///avvik
hibernate.connection.username dag
hibernate.connection.password password


#Hibernate Connection Pool
hibernate.connection.pool_size 5

###################################
### Apache DBCP Connection Pool ###
###################################

## connection pool

hibernate.dbcp.maxActive 100
hibernate.dbcp.whenExhaustedAction 1
hibernate.dbcp.maxWait 120000
hibernate.dbcp.maxIdle 10

## prepared statement cache

hibernate.dbcp.ps.maxActive 100
hibernate.dbcp.ps.whenExhaustedAction 1
hibernate.dbcp.ps.maxWait 120000
hibernate.dbcp.ps.maxIdle 10

## optional query to validate pooled connections:

#hibernate.dbcp.validationQuery select 1 from dual
#hibernate.dbcp.testOnBorrow true
#hibernate.dbcp.testOnReturn false

#Proxool Connection Pool
hibernate.proxool.pool_alias pool1


##MISCELLANEOUS SETTINGS
#Show SQL
hibernate.show_sql true

#auto shema export
hibernate.hbm2ddl.auto create

#set the the maximum JDBC 2 batch size (a nonzero value enables batching)
hibernate.jdbc.batch_size 0

#use streams when writing binary types to/from JDBC
hibernate.jdb.use_streams_for_binary true

#Set the maximum depth of the outer join fetch tree
hibernate.max_fetch_depth 1

#enable the query cache
hibernate.cache.use_query_cache true

#cache implementation
hibernate.cache.provider_class net.sf.ehcache.hibernate.Provider


hibernate .cfg.xml


<?xml version='1.0' encoding='utf-8'?>

<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>

<session-factory>


<!-- Mapping files -->

<mapping resource="bin/user/*.hbm.xml"/>

</session-factory>

</hibernate-configuration>


Top
 Profile  
 
 Post subject: Figured it out
PostPosted: Fri Feb 13, 2004 3:45 am 
Beginner
Beginner

Joined: Mon Feb 09, 2004 6:49 am
Posts: 21
When I solved my saving to database problem, also on this forum, I figured out what was wrong;
In hibernate.properties I found:

#auto shema export
hibernate.hbm2ddl.auto create

Changing from create to update solved all my problems, both that of saving to db and exporting chema to db.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.