-->
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.  [ 1 post ] 
Author Message
 Post subject: Persisting member objects
PostPosted: Tue Feb 13, 2007 12:54 pm 
Newbie

Joined: Thu Aug 10, 2006 7:43 am
Posts: 14
I am running Hibernate 3.1.3 and have the following issue:

I have an Entity-Class called 'Data' which holds/assiciates a Collection of Event-Objects.
'Data' is a 'complete' Class representing a table and its columns.
'Event' s a Class representing a relation table between Table_Data and Table_Event and has no own primary key.


Here aa extract of Data.hbm.xml:
Code:
<set
    name="historySet"
    table="Table_Data_Event"
    lazy="false"
    cascade="all-delete-orphan"
    sort="unsorted"
    order-by="data_ID, event_ID"
>

    <key
        column="data_ID"
    >
    </key>
   
    <many-to-many
        class="com.company.project.model.Event"
        column="event_ID"
        outer-join="auto"
     />
</set>


Here Event.hbm.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping
>
    <class
        name="com.company.project.model.Event"
        table="Table_Event"
    >

        <id
            name="id"
            column="event_ID"
            type="java.lang.Integer"
        >
            <generator class="identity">
              <!-- 
                  To add non XDoclet generator parameters, create a file named
                  hibernate-generator-params-Event.xml
                  containing the additional parameters and place it in your merge dir.
              -->
            </generator>
        </id>

        <property
            name="date"
            type="java.util.Date"
            update="true"
            insert="true"
            column="eventDate"
        />

        <property
            name="description"
            type="java.lang.String"
            update="true"
            insert="true"
            column="description"
        />

        <many-to-one
            name="employee"
            class="com.company.project.model.Employee"
            cascade="none"
            outer-join="auto"
            update="true"
            insert="true"
            column="employee"
        />

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-Event.xml
            containing the additional properties and place it in your merge dir.
        -->

    </class>

</hibernate-mapping>


I thought Hibernate saves Event objects too, when I save a Data object (since the Event objects are within a Set member of Data) but exactly this does not happen.

What am I doing wrong or what do I forget to do?

Thank you
du-it


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.