-->
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: SortedSet mit primitiven Datentypen Mapping File
PostPosted: Wed Oct 27, 2010 12:49 pm 
Newbie

Joined: Fri Jun 27, 2008 2:50 pm
Posts: 4
Liebe Hibernate Community,
Villeicht erscheint meine Frage für einen oder anderen zu einfach, aber leider habe ich noch keine Antwort beim googlen darauf gefunden.

Frage:
Wie soll eine Hibernate Mapping Datei für folgende POJO aussehen? Ich habe insbesonders das Problemm beim der Definition eines SortedSet's welcher primitive Datentyp Werte enthält.
Code:
package hibernate.primitive.type;

import java.util.SortedSet;

/**
* how to map this bean to the hibernate?
* @author Andreas Hollmann
*
*/
public class MyBean{
   private long id;
   private String description;
   private SortedSet<Long> values;
   
   /**
    * constructor
    */
   public MyBean() {
      super();
   }
   
   public long getId() {
      return id;
   }

   private void setId(long id) {
      this.id = id;
   }


   public String getDescription() {
      return description;
   }
   public void setDescription(String description) {
      this.description = description;
   }
   public SortedSet<Long> getValues() {
      return values;
   }
   
   private void setValues(SortedSet<Long> values) {
      this.values = values;
   }
   
}


und das ist mapping Datei wie ich sie mir vorstelle. An einer Stelle weiß ich nicht mehr weiter, ich habe diese Stelle mit einem Kommentar versehen:
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">
<hibernate-mapping package="hibernate.primitive.type">
   <class name="MyBean">
        <id name="id" column="id" type="long">
            <generator class="native"/>
        </id>
      <property name="description"    column="description"    type="string"/>      
      
      <set name="values" lazy="true" cascade="all,delete-orphan" inverse="false" sort="natural">
         was soll hier stehen?
       </set>
       
   </class>
</hibernate-mapping>


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.