-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to remove schema attribute from generated POJO api
PostPosted: Thu Aug 21, 2008 9:17 am 
Newbie

Joined: Thu Aug 21, 2008 9:04 am
Posts: 1
Location: India
Hi All,
I am using hibernate reverse engineering build script to create POJO apis.
The sample POJO apis generated is as follows:
/////////////////////////////////////////////////////
/**
* StAwardProfile generated by hbm2java
*/
@Entity
@Table(name="ST_AWARD_PROFILE"
schema="SMAXQAINT"
)

public class StAwardProfile implements java.io.Serializable {


private long awardProfileId;
private String awardName;

.....
}
/////////////////////////////////////////////////////

It is adding schema="SMAXQAINT" attribute in @Table annotation.
I do not want the schema attribute there as it will not work if the schema name is changed or for more than one schema in production.

Please let me know how to I remove this Schema attribute from POJO API.

Here is the Reverse engineering xml file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
<hibernate-reverse-engineering>
<table-filter match-schema="SMAXQAINT" match-name="ST_.*" package="com.maximus.stt.comp.schoolmax.student.model" />


ANT BUILD SCRIPT FILE:

<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="toolslib"/>

<jdbcconfiguration configurationfile="${hibernateConfigdir}/hibernate.cfg.xml" revengfile="${hibernateConfigdir}/hibernate.reveng.xml" packagename="com.maximus.stt.comp.schoolmax.system.model"/>

<hbm2java jdk5="true" ejb3="true"/>


Hibernate-CFG.XML file contents:

<!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:@172.18.9.20:1521:SMAXDB
</property>
<property name="connection.username">SMAXQAINT</property>
<property name="connection.password">SMAXQAINT</property>

<!-- JDBC connection pool -->
<property name="connection.pool_size">1</property>

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

<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>


Please let me know, what are changes so that i will not add schema tag inside the generated POJO api.


Thanks in advance.
Dinesh


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 22, 2008 4:47 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
set the default_schema when generating.

_________________
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.  [ 2 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.