-->
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: reverse engineer oracle schema
PostPosted: Fri Sep 25, 2009 5:56 am 
Newbie

Joined: Thu Aug 20, 2009 1:12 pm
Posts: 11
Hi. I downloaded hibernate tools and successfully managed to reverse engineer mysql tables via the eclipse plugins. Now I am trying to do the same for oracle 10g. When I attempt to reverse engineer (RE) through eclipse it is attempting to RE all schemas whereas I want to only RE a specific schema. Does anyone know how to do this?

Please note I say attempt as an error is being produced when it attempts to RE one of the schemas I am not interested in:
Code:
org.hibernate.cfg.JDBCBinderException: Duplicate class name 'AllFileGroups' generated for 'org.hibernate.mapping.Table(SYS._ALL_FILE_GROUPS)'. Same name where generated for 'org.hibernate.mapping.Table(SYS._ALL_FILE_GROUPS)'
Duplicate class name 'AllFileGroups' generated for 'org.hibernate.mapping.Table(SYS._ALL_FILE_GROUPS)'. Same name where generated for 'org.hibernate.mapping.Table(SYS._ALL_FILE_GROUPS)'
  <No message>


Top
 Profile  
 
 Post subject: Re: reverse engineer oracle schema
PostPosted: Fri Sep 25, 2009 7:26 am 
Newbie

Joined: Thu Aug 20, 2009 1:12 pm
Posts: 11
Hi. I have opted for a different approach using ant. The build is successfull but nothing is ouput. Can someone please advise:
build.xml
Code:
<project default="" basedir=".">
   
   <property name="domainobjects.dir" value="out"></property>
   <property name="lib" value="lib"></property>

   <path id="toolslib">
       <path location="${lib}/hibernate-tools.jar" />
      <path location="${lib}/hibernate3.jar" />
      <path location="${lib}/freemarker.jar" />
      <path location="${lib}/ojdbc14.jar" />
      <path location="${lib}/commons-logging-1.0.4.jar" />
      <path location="${lib}/dom4j-1.6.1.jar" />
      <path location="${lib}/slf4j-api-1.5.8.jar" />
      <path location="${lib}/slf4j-simple-1.5.8.jar" />
      <path location="${lib}/commons-collections-2.1.1.jar" />
      <path location="${lib}/hibernate-annotations.jar" />
      <path location="${lib}/hibernate-commons-annotations.jar" />
      <path location="${lib}/ejb3-persistence.jar" />
   </path>

   <taskdef name="hibernatetool"
            classname="org.hibernate.tool.ant.HibernateToolTask"
            classpathref="toolslib" />   
   
   <hibernatetool destdir="${domainobjects.dir}/generated">
        <annotationconfiguration configurationfile="hibernate.cfg.xml" />
        <hbm2hbmxml/>
   </hibernatetool>

</project>

hibernate.cfg.xml
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

    <session-factory>

        <!-- Database connection settings -->
        <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
        <property name="connection.url">jdbc:oracle:thin:@localhost:1521:XE</property>
        <property name="connection.username">user</property>
        <property name="connection.password">pass</property>
        <property name="default_schema">myschema</property>

        <!-- JDBC connection pool (use the built-in) -->
        <property name="connection.pool_size">1</property>

        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>

        <!-- Enable Hibernate's automatic session context management -->
        <property name="current_session_context_class">thread</property>

        <!-- Disable the second-level cache  -->
        <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">true</property>

    </session-factory>

</hibernate-configuration>


Top
 Profile  
 
 Post subject: Re: reverse engineer oracle schema
PostPosted: Fri Sep 25, 2009 7:38 am 
Newbie

Joined: Thu Aug 20, 2009 1:12 pm
Posts: 11
reworked as below and now working. cheers

Code:
<hibernatetool destdir="${domainobjects.dir}">
      <jdbcconfiguration configurationfile="hibernate.cfg.xml"/>
      <hbm2java jdk5="true" ejb3="true"/>
</hibernatetool>


Top
 Profile  
 
 Post subject: Re: reverse engineer oracle schema
PostPosted: Fri Sep 25, 2009 7:41 am 
Newbie

Joined: Thu Aug 20, 2009 1:12 pm
Posts: 11
i notice the eclipse plugin is able to generate dao code as well. does anyone know what configuration is required in the ant script for this? its not something i require as I prefer developing my own dao code from scratch, but just out of interest...


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.