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: Problem identifying primary key in mapping file
PostPosted: Sat Mar 28, 2009 6:10 am 
Newbie

Joined: Sat Mar 28, 2009 5:51 am
Posts: 1
Location: Paris, France
I have the following class structure:

Code:
public class A {
   private APK pk;
   public APK getPK() {
       return pk;
   }
   public void setPK(APK pk) {
       this.pk = pk;
   }
}

public class APK {
  private int id;
  public int getId() {
    return id;
  }
  public void setId(int id) {
    this.id = id;
  }
}


I think in Hibernate terms, this is considered a composite key, however in reality it is not, since the key consists of a single attribute/column (it's just in another class). I can map this with not problem as a composite key.

The problem is that I would like to have the id value autogenerated using the identity feature of SQLServer 2008, however from everything I have read, this is not possible because Hibernate treats this as a composite-key and not just a component.

Is this possible to accomplish without having to implement my own classes to generate the id?

I'm using Hibernate 3, SQL Server 2008, and Java 1.5.

Thank you in advance,
Maury


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.