-->
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:47 pm 
Newbie

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

Ich habe eine Entity-Klasse namens 'Data', die eine Collection von Event-Objekten enthält.
'Data' ist soz. eine voll ausgewachsene Klasse, die eine Tabelle und deren Spalten abbildet.
'Event' ist eine Klasse, die eine Relationstabelle zwischen Table_Data und Table_Event abbildet
und keinen eigenen Primärschlüssel hat.


Hier der Abschnitt aus 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>


Hier 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>


Ich nahme an, dass Hibernate, wenn ich ein save(myData) ausführe, automatisch die von der Applikation
erzeugten Event-Objekte speichert, aber eben genau das geschieht leider nicht.
woran liegt das? Was habe ich vergessen oder falsch gemacht?


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.