-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problems with created XML's (repeated colums)
PostPosted: Mon Jan 22, 2007 7:37 pm 
Newbie

Joined: Wed Aug 31, 2005 5:56 pm
Posts: 5
Hibernate version: 3 (Hibernate tools 3.1 beta 5)

I have a problem generating XML's from hbm2hbmxml in hibernate tools. Everything runs perfeclty and i have a mapping file like this:

Code:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Jan 22, 2007 5:37:40 PM by Hibernate Tools 3.1.0.beta5 -->
<hibernate-mapping>
    <class name="FlightRecord" table="flight_record">
        <comment>
        </comment>

        <id name="idFlightRecord" type="int">
            <column name="ID_FLIGHT_RECORD" />

            <generator class="native" />
        </id>

        <many-to-one name="accountTypes" class="AccountTypes" fetch="select">
            <column name="ACCOUNT_TYPE" length="45">
                <comment>
                </comment>
            </column>

            <column name="AIRLINECODE" length="3">
                <comment>
                </comment>
            </column>
        </many-to-one>

      (...)

        <many-to-one name="ticketTypes" class="TicketTypes" update="false" insert="false" fetch="select">
            <column name="TICKET_TYPE" length="50">
                <comment>
                </comment>
            </column>

            <column name="AIRLINECODE" length="3">
                <comment>
                </comment>
            </column>
        </many-to-one>

        <property name="lastName" type="string">
            <column name="LAST_NAME" length="45">
                <comment>
                </comment>
            </column>
        </property>

        <property name="firstName" type="string">
            <column name="FIRST_NAME" length="45">
                <comment>
                </comment>
            </column>
        </property>

     (...)

    </class>
</hibernate-mapping>



The problem is as it won't let me persist the TICKET_TYPE column because I have to set update="false" and insert="false"due to the Repeated column in mapping for entity. I have that issue in multiple tables since the foreign key often overlaps in the use of fields. What is the right approach for that? Any suggestions would be highly appreciated!

I'm really desperate trying to figure this one out. I know there are workarounds but shouldn't there be a more consistent way in implementing it by using .ftl - files or even easier?

Thanks...

Peter


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 22, 2007 9:16 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
You will require the additional tickettype property that can be set approrpiately (when you add the many-to-one entity). Natually it would be easier if you could improve the schema - but often that is not possible.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 23, 2007 9:58 am 
Newbie

Joined: Wed Aug 31, 2005 5:56 pm
Posts: 5
Thanks David,

I highly appreciate your reply. Does that mean I have to go in and add the property manually or is there a way to let Hibernate Tools create properties and many-to-one relationships (without having to create a whole set of template files)?


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