-->
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.  [ 1 post ] 
Author Message
 Post subject: schemaExport problems
PostPosted: Mon Oct 03, 2005 7:25 am 
Newbie

Joined: Tue Sep 27, 2005 10:12 am
Posts: 9
Hi,

I am haivng problems with SchemaExport.Pls help

Hibernate version 2.1
hibernate-extensions-2.1.3
hsqldb1.8.jar

my mapping file:
********************************************************
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">


<hibernate-mapping>
<class name="com.javasrc.books.Book" table="BOOK">
<meta attribute="class-description">
Defines a book in our bookstore database
</meta>

<id name="id" type="int" column="BOOK_ID">
<meta attribute="scope-set">protected</meta>
<generator class="native"/>
</id>

<property name="title" type="string" not-null="true"/>

<property name="author" type="string" not-null="true"/>

<property name="price" type="float">
<meta attribute="field-description">Retail cost of the book</meta>
</property>

<property name="publishDate" type="date">
<meta attribute="field-description">When the book was published</meta>
</property>

</class>
</hibernate-mapping>

********************************************************

my source file
*****************************************************
package com.javasrc.books;

import java.io.Serializable;
import java.util.Date;
import org.apache.commons.lang.builder.ToStringBuilder;


/**
* Defines a book in our bookstore database
*
*/
public class Book implements Serializable {

/** identifier field */
private Integer id;

/** persistent field */
private String title;

/** persistent field */
private String author;

/** nullable persistent field */
private Float price;

/** nullable persistent field */
private Date publishDate;

/** full constructor */
public Book(String title, String author, Float price, Date publishDate) {
this.title = title;
this.author = author;
this.price = price;
this.publishDate = publishDate;
}

/** default constructor */
public Book() {
}

/** minimal constructor */
public Book(String title, String author) {
this.title = title;
this.author = author;
}

public Integer getId() {
return this.id;
}

protected void setId(Integer id) {
this.id = id;
}

public String getTitle() {
return this.title;
}

public void setTitle(String title) {
this.title = title;
}

public String getAuthor() {
return this.author;
}

public void setAuthor(String author) {
this.author = author;
}

/**
* Retail cost of the book
*/
public Float getPrice() {
return this.price;
}

public void setPrice(Float price) {
this.price = price;
}

/**
* When the book was published
*/
public Date getPublishDate() {
return this.publishDate;
}

public void setPublishDate(Date publishDate) {
this.publishDate = publishDate;
}

public String toString() {
return new ToStringBuilder(this)
.append("id", getId())
.toString();
}

}

*****************************************************


my hibernate.properties
*********************************************************
hibernate.dialect=net.sf.hibernate.dialect.HSQLDialect
hibernate.connection.driver_class=org.hsqldb.jdbcDriver
hibernate.connection.url=jdbc:hsqldb:data/book
hibernate.connection.username=sa
hibernate.connection.password=
*********************************************************

my build.xml

**********************************************************
<?xml version="1.0"?>
<project name="BookStore Example" default="compile" basedir=".">

<!-- Set our file locations -->
<property name="source.root" value="src"/>
<property name="class.root" value="classes"/>
<property name="data.dir" value="data"/>
<property name="hibernate.home" value="/home/user/download/Hibernate/hibernate-2.1" />
<property name="hibernate.tools" value="/home/user/download/Hibernate/hibernate-extensions-2.1.3" />
<property name="hsqldb.home" value="/home/user/hibernate/lib" />

<!-- Set our classpath -->
<path id="project.class.path">
<!-- Include our own classes, of course -->
<pathelement location="${class.root}"/>
<!-- Include jars in the project library directory -->
<fileset dir="${hibernate.home}">
<include name="hibernate2.jar" />
</fileset>
<fileset dir="${hibernate.home}/lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${hibernate.tools}/tools/lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${hibernate.tools}/tools">
<include name="hibernate-tools.jar"/>
</fileset>
<fileset dir="${hsqldb.home}/">
<include name="hsqldb1.8.jar"/>
</fileset>
</path>

<!-- Launch the DB GUI for creating/modifing -->
<target name="launchdb" description="Launch HSQLDB database management GUI">
<java classname="org.hsqldb.util.DatabaseManager" fork="yes">
<classpath refid="project.class.path"/>
<arg value="-driver"/>
<arg value="org.hsqldb.jdbcDriver"/>
<arg value="-url"/>
<arg value="jdbc:hsqldb:${data.dir}/book"/>
<arg value="-user"/>
<arg value="sa"/>
</java>
</target>
<!-- Load Hibernate's code generation tool -->
<taskdef name="hbm2java"
classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
classpathref="project.class.path"/>

<!-- Generate the java code for all mapping files in our source tree -->
<target name="codegen"
description="Generate Java source from the O/R mapping files">
<hbm2java output="${source.root}">
<fileset dir="${source.root}">
<include name="**/*.hbm.xml"/>
</fileset>
</hbm2java>
</target>

<!-- Create our runtime subdirectories and copy resources into them -->
<target name="prepare" description="Sets up build structures">
<mkdir dir="${class.root}"/>

<!-- Copy our property files and O/R mappings for use at runtime -->
<copy todir="${class.root}" >
<fileset dir="${source.root}" >
<include name="**/*.properties"/>
<include name="**/*.hbm.xml"/>
</fileset>
</copy>
</target>

<!-- Compile the java source of the project -->
<target name="compile" depends="prepare"
description="Compiles all Java classes">
<javac srcdir="${source.root}"
destdir="${class.root}"
debug="on"
optimize="off"
deprecation="on">
<classpath refid="project.class.path"/>
</javac>
</target>

<target name="schema" depends="compile"
description="Generate DB schema from the O/R mapping files">

<!-- Teach Ant how to use Hibernate's schema generation tool -->
<taskdef name="schemaexport"
classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="project.class.path"/>

<schemaexport properties="${class.root}/hibernate.properties"
quiet="no" text="no" drop="no" delimiter=";">
<fileset dir="${class.root}">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaexport>
</target>
</project>

*********************************************************







I am getting the folloing output:
***************************************
schema:
[schemaexport] [INFO] Environment - -Hibernate 2.1.8
[schemaexport] [INFO] Environment - -loaded properties from resource hibernate.properties: {hibernate.dialect=net.sf.hibernate.dialect.HSQLDialect, hibernate.cglib.use_reflection_optimizer=true, hibernate.connection.password=, hibernate.connection.url=jdbc:hsqldb:data/book, hibernate.connection.username=sa, hibernate.connection.driver_class=org.hsqldb.jdbcDriver}
[schemaexport] [INFO] Environment - -using CGLIB reflection optimizer
[schemaexport] [INFO] Configuration - -Mapping file: /home/user/hibernate/project/classes/com/javasrc/books/Book.hbm.xml
[schemaexport] [INFO] Binder - -Mapping class: com.javasrc.books.Book -> BOOK
[schemaexport] [INFO] Dialect - -Using dialect: net.sf.hibernate.dialect.HSQLDialect
[schemaexport] [INFO] Configuration - -processing one-to-many association mappings
[schemaexport] [INFO] Configuration - -processing one-to-one association property references
[schemaexport] [INFO] Configuration - -processing foreign key constraints
[schemaexport] [INFO] Configuration - -processing one-to-many association mappings
[schemaexport] [INFO] Configuration - -processing one-to-one association property references
[schemaexport] [INFO] Configuration - -processing foreign key constraints
[schemaexport] [INFO] SchemaExport - -Running hbm2ddl schema export
[schemaexport] [INFO] SchemaExport - -exporting generated schema to database
[schemaexport] [INFO] DriverManagerConnectionProvider - -Using Hibernate built-in connection pool (not for production use!)
[schemaexport] [INFO] DriverManagerConnectionProvider - -Hibernate connection pool size: 20
[schemaexport] [INFO] DriverManagerConnectionProvider - -using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:data/book
[schemaexport] [INFO] DriverManagerConnectionProvider - -connection properties: {user=sa, password=}
[schemaexport] java.sql.SQLException: General error: java.lang.Error: Not implemented
[schemaexport] at org.hsqldb.jdbc.jdbcUtil.sqlException(org.hsqldb.HsqlException) (Unknown Source)
[schemaexport] at org.hsqldb.jdbc.jdbcConnection.jdbcConnection(org.hsqldb.HsqlProperties) (Unknown Source)
[schemaexport] at org.hsqldb.jdbcDriver.getConnection(java.lang.String, java.util.Properties) (Unknown Source)
[schemaexport] at org.hsqldb.jdbcDriver.connect(java.lang.String, java.util.Properties) (Unknown Source)
[schemaexport] at java.sql.DriverManager.getConnection(java.lang.String, java.util.Properties) (/lib/ssa/libgcj.so.4.0.0)
[schemaexport] at net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnection() (Unknown Source)
[schemaexport] at net.sf.hibernate.tool.hbm2ddl.SchemaExport.execute(boolean, boolean, boolean, boolean) (Unknown Source)
[schemaexport] at net.sf.hibernate.tool.hbm2ddl.SchemaExport.create(boolean, boolean) (Unknown Source)
[schemaexport] at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute() (Unknown Source)
[schemaexport] at org.apache.tools.ant.UnknownElement.execute() (/usr/lib/lib-org-apache-tools-ant-1.5.2.so)
[schemaexport] at org.apache.tools.ant.Task.perform() (/usr/lib/lib-org-apache-tools-ant-1.5.2.so)
[schemaexport] at org.apache.tools.ant.Target.execute() (/usr/lib/lib-org-apache-tools-ant-1.5.2.so)
[schemaexport] at org.apache.tools.ant.Target.performTasks() (/usr/lib/lib-org-apache-tools-ant-1.5.2.so)
[schemaexport] at org.apache.tools.ant.Project.executeTarget(java.lang.String) (/usr/lib/lib-org-apache-tools-ant-1.5.2.so)
[schemaexport] at org.apache.tools.ant.Project.executeTargets(java.util.Vector) (/usr/lib/lib-org-apache-tools-ant-1.5.2.so)
[schemaexport] at org.apache.tools.ant.Main.runBuild(java.lang.ClassLoader) (/usr/lib/lib-org-apache-tools-ant-1.5.2.so)
[schemaexport] at org.apache.tools.ant.Main.start(java.lang.String[], java.util.Properties, java.lang.ClassLoader) (/usr/lib/lib-org-apache-tools-ant-1.5.2.so)
[schemaexport] at org.apache.tools.ant.Main.main(java.lang.String[]) (/usr/lib/lib-org-apache-tools-ant-1.5.2.so)
[schemaexport] [ERROR] SchemaExport - -schema export unsuccessful <java.sql.SQLException: General error: java.lang.Error: Not implemented>

BUILD SUCCESSFUL
Total time: 1 second


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

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.