-->
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: Problems with UserType for Primary Key
PostPosted: Thu Oct 11, 2007 4:26 am 
Regular
Regular

Joined: Mon Mar 06, 2006 6:18 am
Posts: 95
Location: Bern, Switzerland
Hi all

we use as UserType for a Primary Key in our model:

Code:
public class JuausAngebot extends AbstractLaufnummerIdModel {

   // Fields

   /** The laufnummerId. */
   private LaufnummerId laufnummerId;
.....

@Override
   @Type(type = "najsre7.dao.hibernate.userType.immutable.ids.AngebotIdUT")
   @Id
   @GeneratedValue(generator = "generator")
   @GenericGenerator(name = "generator", strategy = "najsre7.model.ids.LaufnummerGenerator", parameters = {
         @Parameter(name = "allocationSize", value = "1"),
         @Parameter(name = "laufnummerType", value = "" + LaufnummerTypesConstants.ANGEBOT),
         @Parameter(name = "sequence", value = "SEQ_TANGEBOT") })
   @Column(name = "ILAUFNUMMER", unique = true, nullable = false, insertable = true, updatable = true, precision = 9, scale = 0)
   public LaufnummerId getLaufnummerId() {
      return laufnummerId;
   }

   /**
    * Sets the laufnummerId.
    *
    * @param laufnummerId the laufnummerId
    */
   @Override
   public void setLaufnummerId(LaufnummerId laufnummerId) {
      this.laufnummerId = laufnummerId;
   }

   /**
    * Gets the kurse.
    *
    * @return kurse
    */
   @OneToMany(fetch = FetchType.LAZY, mappedBy = "angebot")
   @Cascade( { CascadeType.ALL, CascadeType.DELETE_ORPHAN })
   @Valid
   public Set<Kurs> getKurse() {
      return this.kurse;
   }


//more properties
}


This works fine with the UserType Id. The problem we have now, is getting the Set with the Kurse in it. This Set is always empty! I don't know if it has something to do with our primary key.

The mapping in Kurs looks like this:

Code:
@ManyToOne(fetch = FetchType.EAGER)
   @JoinColumn(name = "FK_TANG_LAUFNR", unique = false, nullable = false, insertable = true, updatable = true)
   public JuausAngebot getAngebot() {
      return this.angebot;
   }


Any ideas what's wrong here?

kind regards
Angela


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.