-->
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: Reverse Engineering database with Eclipse plugin
PostPosted: Wed Jun 22, 2005 9:39 pm 
Newbie

Joined: Wed Jun 22, 2005 3:58 am
Posts: 14
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

I tried to use the reverse engineering feature of the Eclipse plugin and I have a question about a certain peculiarity I noticed.

The mapping files were generated very well. For example:

Mapping documents:
Code:
<hibernate-mapping>
<!--
        Auto-generated mapping file from
        the hibernate.org cfg2hbm engine
-->
  <class name="com.allcorp.premium.coverage.data.orm.classes.XatAutoCovrg" table="XAT_AUTO_COVRG" schema="ALLIDB" catalog="R0234376" lazy="false">
    <composite-id name="id" class="com.allcorp.premium.coverage.data.orm.classes.XatAutoCovrgId">
      <key-property name="AcvProduct" type="java.lang.Character">
        <column name="ACV_PRODUCT" scale="8" precision="0" not-null="true" sql-type="CHAR" />
      </key-property>
... etc


So, we have a column declared as CHAR(8) in the database.

Here is the code generated for this mapping:
Code:
package com.allcorp.premium.coverage.data.orm.classes;


/**
* XatAutoCovrgId generated by hbm2java
*/
public class XatAutoCovrgId  implements java.io.Serializable {

    // Fields   

private java.lang.Character AcvProduct;
private java.lang.Character AcvProductType;
private java.lang.Character AcvVehicleType;
private java.lang.Short AcvVersion;

...etc


Notice how the java type chosen for the CHAR(8) column is a java.lang.Character, which only takes 1 character instead of 8.

Why is hbm2java doing it this way?


Top
 Profile  
 
 Post subject: sorry
PostPosted: Wed Jun 22, 2005 9:46 pm 
Newbie

Joined: Wed Jun 22, 2005 3:58 am
Posts: 14
My apologies - this is a 'Tools' forum question. I will re-post it there.


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.