-->
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.  [ 10 posts ] 
Author Message
 Post subject: @PrimaryKeyJoinColumn doesn't exist!!!
PostPosted: Sun Oct 23, 2005 9:01 am 
Beginner
Beginner

Joined: Fri Sep 02, 2005 3:42 pm
Posts: 32
Hy people, i can't import annotation @PrimaryKeyJoinColumn in my projetc and i don't know why. I put the ejb3.0 jar file in my classpath, all hibernate jars file in my classpath and i can't import this annotation. Someone knows why?

Thanks,

Alberto


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 24, 2005 5:43 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
you might use a very old ejb3 jar file.

_________________
Emmanuel


Top
 Profile  
 
 Post subject: @PrimaryKeyJoinColumn doesn't exist!!!
PostPosted: Mon Oct 24, 2005 12:52 pm 
Beginner
Beginner

Joined: Fri Sep 02, 2005 3:42 pm
Posts: 32
Thanks Emmanuel, i have another question about the hibernate mapping. Why When i am trying map a inheritance with hibernate, it is creating a big table with all properties of the classes that extends the super class. If you know anything about this please answer me.

Thanks,

Alberto


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 12:26 am 
Newbie

Joined: Tue Sep 13, 2005 10:57 pm
Posts: 10
hi, you can use table_per_class or join inheritance strategy.if used table_per_class, id cannot use auto id,you can use table id.


Top
 Profile  
 
 Post subject: @PrimaryKeyJoinColumn doesn't exist!!!
PostPosted: Tue Oct 25, 2005 4:23 pm 
Beginner
Beginner

Joined: Fri Sep 02, 2005 3:42 pm
Posts: 32
I'm sorry xiangya, i didn't understand what you tried to explain me. I'm posting my class here for you take look. If can you modifie my class i will apreciate too much.
Code:
@Entity
@InheritanceJoinColumn(name="cod_Periferico")
@Table(name="Hd")
public class Hd extends Periferico{
    //private Long cod_Periferico;
    private long tamanho;   
    /*@Id (generate=GeneratorType.AUTO)
   public Long getCod_Periferico() {
       
      return cod_Periferico;
   }
   public void setCod_Periferico(Long cod_Periferico) {
      this.cod_Periferico = cod_Periferico;
   }*/
   public long getTamanho() {
      return tamanho;
   }
   public void setTamanho(long tamanho) {
      this.tamanho = tamanho;
   }
   public Hd(){
      
   }
}



Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 8:37 pm 
Newbie

Joined: Tue Sep 13, 2005 10:57 pm
Posts: 10
hi,maybe this can help:
Code:
//all inherited object shared one id spaces.
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
[abstract] class Pref...{
  @Id(generate = GeneratorType.AUTO)
  getId(){...}
}
@Entity
class Hd extends Pref...{
}

Code:
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
[abstract] class Pref...{
  //cannot use auto id, if Table_per_class,
  //others generated id;
  @Id(generate = GeneratorType.TABLE)
  getId(){...}
}
@Entity
class Hd extends Pref...{
}


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 9:55 pm 
Beginner
Beginner

Joined: Fri Sep 02, 2005 3:42 pm
Posts: 32
I'm sorry xiangya, but hibernate still creates one big table. I don't know why? In the hibernate documentation the explanation is like that you gave me. If you have any other ideas, please, post here. I'm still trying here.

Thanks,

Alberto


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 11:19 pm 
Newbie

Joined: Tue Sep 13, 2005 10:57 pm
Posts: 10
Hi,It's my sorry,
if you want a big table,
you can use InheritanceType.SINGLE_TABLE with discriminator.
like this:

Code:
@Entity()
@Inheritance(strategy=InheritanceType.SINGLE_TABLE,
discriminatorType=DiscriminatorType.STRING,
discriminatorValue="Periferico")
@DiscriminatorColumn(name="PerifericoType")
public class Periferico{ ... }

@Entity()
@Inheritance(discriminatorValue="HD")
public class Hd extends Periferico { ... }


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 11:48 am 
Beginner
Beginner

Joined: Fri Sep 02, 2005 3:42 pm
Posts: 32
I'm sorry again. I don't want a big table. The thing is, when i put that configuration like you say(@Entity
@Inheritance(strategy = InheritanceType.JOINED)
) hibernate still creates a big table for me. Do you know why?

Thanks,

Alberto


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 4:28 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Check you code, it should work. Look at the unit test suite and change it until you reach your domain model

_________________
Emmanuel


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

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.