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: My god, this legacy data
PostPosted: Wed Mar 09, 2005 2:55 pm 
Regular
Regular

Joined: Thu Feb 24, 2005 2:34 pm
Posts: 80
Hi, i have a great problem, i will find a bad legacy data here.
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>

   <class name="vo.as400.PfVO" table="sdgtwb_dat.arcpf00f" lazy="false">


     <composite-id name="pfvopk" class="vo.pk.PfVOPK">
              <key-property name="stagpf" column="stagpf" type="string"/>
              <key-property name="modepf" column="modepf" type="string"/>
              <key-property name="matepf" column="matepf" type="string"/>
        </composite-id>
       
         

         <property name="de50pf"  column="de50pf" type="string" not-null="true"/>
         <property name="fl20pf" column="fl20pf" type="string" not-null="true"/>

   <many-to-one name="modevo" class="vo.as400.ModeVO" lazy="false" cascade="all" update="false" insert="false">
      <column name="STAGPF"/>
      <column name="MODEPF"/>
   </many-to-one>

       
        <many-to-one name="stagione" class="vo.as400.CStagione" lazy="false" update="false" insert="false">
      <column name="STAGPF"/>
   </many-to-one>
   

        </class>
</hibernate-mapping>



<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>


   <class name="vo.as400.CStagione" table="sdgtwb_dat.arctb00f" lazy="false">


     <id name="cdc_stag" column="cdeltb" >
             <generator class="assigned"/>
       </id>

<property name="dsc_stag"  column="DATITB" type="string" />



   <filter name="stagione" condition="CDTBTB IN (:tipo')"/>

        </class>

<filter-def name="stagione">
<filter-param name="tipo" type="string"/>
</filter-def>

</hibernate-mapping>







This code work ok in my test table, but in the legacy don't work, i'm looking for the problem, and i see the in my legacy table="sdgtwb_dat.arctb00f" there are the blank space before the code.
for examples

in table A
stagpf 1976 without blank space

in table B
stagmo blankblank1976blankblank

help pelase, how can map this .... I am already hating this schema legacy...

with jdbc i have resolve where TRIM(CDELTB)=? and work but in Hibernate.

I'm using hibernate 3 rc1
Thank's in advance
Devis


Top
 Profile  
 
 Post subject: Greate Hibernate
PostPosted: Thu Mar 10, 2005 6:05 am 
Regular
Regular

Joined: Thu Feb 24, 2005 2:34 pm
Posts: 80
I have resolve my problem in this way, work fine.
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>

   <class name="vo.as400.PfVO" table="sdgtwb_dat.arcpf00f" lazy="false">


     <composite-id name="pfvopk" class="vo.pk.PfVOPK">
              <key-property name="stagpf" column="stagpf" type="string"/>
              <key-property name="modepf" column="modepf" type="string"/>
              <key-property name="matepf" column="matepf" type="string"/>
        </composite-id>
       
         

         <property name="de50pf"  column="de50pf" type="string" not-null="true"/>
         <property name="fl20pf" column="fl20pf" type="string" not-null="true"/>

   <many-to-one name="modevo" class="vo.as400.ModeVO" lazy="false" cascade="all" update="false" insert="false">
      <column name="STAGPF"/>
      <column name="MODEPF"/>
   </many-to-one>

       
        <many-to-one name="stagione" class="vo.as400.CStagione" lazy="false" update="false" insert="false"
        formula="(Select S.cdeltb from sdgtwb_dat.arctb00f S where trim(S.cdeltb)=stagpf and S.CDTBTB='STG')"
        >
      <column name="STAGPF"/>
   </many-to-one>
   

        </class>
</hibernate-mapping>





Bye Devis

Ps.
i don't understand one thing, as ago Hibernate, to initialize cdc_stag, dsc_stag of the class CStagione if in the field it formulates I pass only him a field in the select,
in fact if you look at mine "(Select S.cdeltb from sdgtwb_dat.arctb00f S where trim(S.cdeltb)=stagpf and S.CDTBTB = 'STG') there are no two selections, however Hibernate CStagione initializes the class in perfect way there is an explanation out of politeness?


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.