-->
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.  [ 12 posts ] 
Author Message
 Post subject: excuding a column. version tag.
PostPosted: Mon Nov 14, 2005 6:57 am 
Newbie

Joined: Mon Oct 31, 2005 12:01 pm
Posts: 12
Hibernate version: 3.1 rc1

hi anyone,

i'm trying to exclude a column from mapping:

Code:
<column name="LNGVERSION" exclude="true"/>


but it doesn't work! Any ideas?

Is there a possibililty to generate <version> tag by reveng ?
I made it with a custom template, but in this way i generate
version tag for all classes. And i don't need it for all classes...

thanks in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 7:20 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
what did you use for the <table> tag in reveng.xml ?

<version> is not generated by reverse engineering at the moment.
Could probably make it so - add a jira for it.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 7:41 am 
Newbie

Joined: Mon Oct 31, 2005 12:01 pm
Posts: 12
Hi max,

my reveng.xml look like:
Code:
<hibernate-reverse-engineering>

   <type-mapping>
        <sql-type jdbc-type="DECIMAL"  precision="10" hibernate-type="java.lang.Long" />    
        <sql-type jdbc-type="DECIMAL"  precision="1" hibernate-type="java.lang.Boolean" />
        <sql-type jdbc-type="DECIMAL"  precision="3" hibernate-type="java.lang.Byte" />
        <sql-type jdbc-type="DECIMAL"  precision="5" hibernate-type="java.lang.Integer" />
        <sql-type jdbc-type="DECIMAL"  precision="38" scale="4" hibernate-type="java.lang.Double" />
   </type-mapping>

   <table-filter match-name=".*" match-schema="CON" />   


   <table schema="CON" name="TBLBOM">
      <primary-key>
         <generator class="sequence">
            <param name="sequence">SEQ_TBLBOM</param>
         </generator>         
      </primary-key>
      <column name="LNGVERSION" exclude="true"/>
   </table>
               
                 ...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 7:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
could you try and run this with full log4j debug output enabled ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 8:28 am 
Newbie

Joined: Mon Oct 31, 2005 12:01 pm
Posts: 12
hier is a part of the logging, where the
properties are building(complete logging
is very long... tell me please what part of it you need):


Code:
...
[hibernatetool] 13:04:50,050 DEBUG JDBCBinder:465 - Sql type mismatch for Column org.hibernate.mapping.Column(LNGBOMID) between DB and wanted hibernate type. Sql type set to 3 instead of -5
[hibernatetool] 13:04:50,050 DEBUG JDBCBinder:663 - Building property lngbomid
[hibernatetool] 13:04:50,060 DEBUG JDBCBinder:673 - Cascading lngbomid with null
[hibernatetool] 13:04:50,060 DEBUG JDBCBinder:663 - Building property transaction
[hibernatetool] 13:04:50,060 DEBUG JDBCBinder:673 - Cascading transaction with null
[hibernatetool] 13:04:50,060 DEBUG JDBCBinder:663 - Building property userCreate
[hibernatetool] 13:04:50,060 DEBUG JDBCBinder:673 - Cascading userCreate with null
[hibernatetool] 13:04:50,060 DEBUG JDBCBinder:663 - Building property userEdit
[hibernatetool] 13:04:50,070 DEBUG JDBCBinder:673 - Cascading userEdit with null
[hibernatetool] 13:04:50,070 DEBUG JDBCBinder:663 - Building property strbom
[hibernatetool] 13:04:50,070 DEBUG JDBCBinder:673 - Cascading strbom with null
[hibernatetool] 13:04:50,070 DEBUG JDBCBinder:663 - Building property strerpno
[hibernatetool] 13:04:50,070 DEBUG JDBCBinder:673 - Cascading strerpno with null
[hibernatetool] 13:04:50,070 DEBUG JDBCBinder:663 - Building property strerpnoleading
[hibernatetool] 13:04:50,070 DEBUG JDBCBinder:673 - Cascading strerpnoleading with null
[hibernatetool] 13:04:50,080 DEBUG JDBCBinder:663 - Building property strstate
[hibernatetool] 13:04:50,080 DEBUG JDBCBinder:673 - Cascading strstate with null
[hibernatetool] 13:04:50,080 DEBUG JDBCBinder:465 - Sql type mismatch for Column org.hibernate.mapping.Column(YSNEXPORT) between DB and wanted hibernate type. Sql type set to 3 instead of -7
[hibernatetool] 13:04:50,080 DEBUG JDBCBinder:663 - Building property ysnexport
[hibernatetool] 13:04:50,080 DEBUG JDBCBinder:673 - Cascading ysnexport with null
[hibernatetool] 13:04:50,080 DEBUG JDBCBinder:663 - Building property strdescription
[hibernatetool] 13:04:50,090 DEBUG JDBCBinder:673 - Cascading strdescription with null
[hibernatetool] 13:04:50,090 DEBUG JDBCBinder:663 - Building property dtmcreated
[hibernatetool] 13:04:50,090 DEBUG JDBCBinder:673 - Cascading dtmcreated with null
[hibernatetool] 13:04:50,110 DEBUG JDBCBinder:663 - Building property dtmedited
[hibernatetool] 13:04:50,110 DEBUG JDBCBinder:673 - Cascading dtmedited with null
[hibernatetool] 13:04:50,110 DEBUG JDBCBinder:465 - Sql type mismatch for Column org.hibernate.mapping.Column(LNGVERSION) between DB and wanted hibernate type. Sql type set to 3 instead of -5
[hibernatetool] 13:04:50,110 DEBUG JDBCBinder:663 - Building property lngversion
[hibernatetool] 13:04:50,110 DEBUG JDBCBinder:673 - Cascading lngversion with null
[hibernatetool] 13:04:50,110 DEBUG JDBCBinder:465 - Sql type mismatch for Column org.hibernate.mapping.Column(LNGBOMID) between DB and wanted hibernate type. Sql type set to 3 instead of -5
[hibernatetool] 13:04:50,120 DEBUG JDBCBinder:663 - Building property bomMappings
[hibernatetool] 13:04:50,120 DEBUG JDBCBinder:673 - Cascading bomMappings with all
[hibernatetool] 13:04:50,120 DEBUG JDBCBinder:465 - Sql type mismatch for Column org.hibernate.mapping.Column(LNGBOMID) between DB and wanted hibernate type. Sql type set to 3 instead of -5
[hibernatetool] 13:04:50,120 DEBUG JDBCBinder:663 - Building property bomCacheInfos
[hibernatetool] 13:04:50,120 DEBUG JDBCBinder:673 - Cascading bomCacheInfos with all
[hibernatetool] 13:04:50,120 DEBUG JDBCBinder:465 - Sql type mismatch for Column org.hibernate.mapping.Column(LNGBOMID) between DB and wanted hibernate type. Sql type set to 3 instead of -5
[hibernatetool] 13:04:50,120 DEBUG JDBCBinder:663 - Building property bomMaterials
[hibernatetool] 13:04:50,131 DEBUG JDBCBinder:673 - Cascading bomMaterials with all
[hibernatetool] 13:04:50,131 DEBUG JDBCBinder:465 - Sql type mismatch for Column org.hibernate.mapping.Column(LNGBOMID) between DB and wanted hibernate type. Sql type set to 3 instead of -5
[hibernatetool] 13:04:50,131 DEBUG JDBCBinder:663 - Building property bomLocations
[hibernatetool] 13:04:50,131 DEBUG JDBCBinder:673 - Cascading bomLocations with all
...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 8:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
lines in the proximity of lines with LNGVERSION in it.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 9:09 am 
Newbie

Joined: Mon Oct 31, 2005 12:01 pm
Posts: 12
There is the only one log-message with LNGVERSION:

Code:
[hibernatetool] 13:04:51,943 DEBUG JDBCBinder:465 - Sql type mismatch for Column org.hibernate.mapping.Column(LNGVERSION) between DB and wanted hibernate type. Sql type set to 3 instead of -5


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 9:21 am 
Newbie

Joined: Mon Oct 31, 2005 12:01 pm
Posts: 12
sorry, there are two more...

Code:
[hibernatetool] 14:13:44,806 DEBUG TemplateHelper:210 - putInContext property=org.hibernate.mapping.Property(lngversion)
[hibernatetool] 14:13:44,846  INFO template:88 - ResourceManager : found hbm/property.hbm.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] 14:13:44,886  INFO template:88 - ResourceManager : found hbm/column.hbm.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] 14:13:44,886 DEBUG TemplateHelper:217 - removeFromContext property=org.hibernate.mapping.Property(lngversion)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 10:14 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
hmm...should be more logging at this point.

I assume it is because some case mismatch or something ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: I encounter this problem also
PostPosted: Wed Dec 07, 2005 12:03 pm 
Newbie

Joined: Wed Dec 07, 2005 11:55 am
Posts: 5
This is my reveng.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >

<hibernate-reverse-engineering>

<type-mapping>
<sql-type jdbc-type="NUMERIC" precision='1'
hibernate-type="boolean" /><!-- length, scale and precision can be used to specify the mapping precisly -->
<!--sql-type jdbc-type="NUMERIC" precision='1' hibernate-type="int" /-->
<!-- the type-mappings are ordered. This mapping will be consulted last, thus overriden by the previous one if precision=1 for the column -->
<sql-type jdbc-type="BLOB" hibernate-type="blob" />
</type-mapping>

<table-filter match-schema="SMUSER" match-name="SAP_INPUT_FILE_DETAIL" exclude="false" package="com.smis.business.component.sap"/>
<table-filter match-schema="SMUSER" match-name="MESSAGE" exclude="false" package="message"/>
<table-filter match-schema="SMUSER" match-name=".*" exclude="false" />
<table-filter match-schema=".*" match-name=".*" exclude="true" /><!-- the table-filter are ordered. This mapping will be consulted last, thus overriden by the previous one -->

<table schema="SMUSER" name="AUDIT_LOG"><!-- table allows you to override/define how reverse engineering are done for a specific table -->
<primary-key>
<generator
class="com.smis.business.framework.utility.UniqueIDGenerator">
</generator>


</primary-key>
<column name="obj_ver_num" exclude="true"/>
</table>

<table name="NOTE"><!-- table allows you to override/define how reverse engineering are done for a specific table -->
<primary-key>
<generator
class="com.smis.business.framework.utility.UniqueIDGenerator">
</generator>

</primary-key>
<column name="OBJ_VER_NUM" exclude="true"/>
</table>
<table name="SIGNATURE"><!-- table allows you to override/define how reverse engineering are done for a specific table -->
<primary-key>
<generator
class="com.smis.business.framework.utility.UniqueIDGenerator">
</generator>

</primary-key>

</table>

</hibernate-reverse-engineering>

Could you please add a <version> tag in reveng.xml,this is very important when we use reveng approach and company lead by DBA.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 07, 2005 12:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
next time, please read the whole thread - thanks.

(in short: put such a request in jira)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: the way to use <version>
PostPosted: Thu Dec 08, 2005 4:07 pm 
Newbie

Joined: Wed Dec 07, 2005 11:55 am
Posts: 5
I try some templates, It's easy to do <version> with template:

Like this:

modify hbm/id.hbm.vm

add this to bottom:

<version
name="objectVersionNumber"
type="int"
column="OBJ_VER_NUM"
/>

in ant task, use this target:

<target name="removeObjVerNum">
<echo message="Remove OBJ_VER_NUM field in hbm.xml"/>
<replace dir="${gen-src.dir}" summary="true">
<replacetoken><![CDATA[
<property name="objectVersionNumber" type="int">
<column name="OBJ_VER_NUM" precision="9" scale="0" not-null="true" />
</property>
]]></replacetoken>
<replacevalue></replacevalue>
</replace>

</target>


haha.. Done.


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