Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: ERROR when I use @Mappedsuperclass and @IdClass together
PostPosted: Thu Jun 14, 2012 12:11 pm 
Newbie

Joined: Thu Jun 14, 2012 12:01 pm
Posts: 1
I get this exception

Code:

org.hibernate.AnnotationException: Property of @IdClass not found in entity br.mil.mar.casnav.jc3iedm.status.AbstractObjectItemStatus: objItem
   at org.hibernate.cfg.AnnotationBinder.fillComponent(AnnotationBinder.java:2407)
   at org.hibernate.cfg.AnnotationBinder.bindIdClass(AnnotationBinder.java:2520)
   at org.hibernate.cfg.AnnotationBinder.mapAsIdClass(AnnotationBinder.java:874)
   at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:692)
...



when I use @Mappedsuperclass and @IdClass together like this:

Code:

@MappedSuperclass
public abstract class AbstractObjectItemAssociation implements Serializable {

   private static final long serialVersionUID = 1L;
   
   @Id
   @ManyToOne
   @JoinColumn(name = "obj_item_id")
   @JsonSerialize(using = JsonRelationSerializer.class)
   @JsonDeserialize(using = JsonObjectItemRelationResolver.class)
   private ObjectItem objItem;

   public void setObjItem(ObjectItem objItem) {
      this.objItem = objItem;
   }

   public ObjectItem getObjItem() {
      return objItem;
   }

}

@Entity(name = "obj_item_stat")
@Table(schema = Config.SCHEMA_JC3)
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "cat_code", discriminatorType = DiscriminatorType.STRING, length = 6)
@IdClass(AbstractObjectItemStatusId.class)
public abstract class AbstractObjectItemStatus extends AbstractObjectItemAssociation implements Serializable {

   private static final long serialVersionUID = 1L;
   
   @Id
   @NotNull
   @Digits(integer = 20, fraction = 0)
   @Column(name = "obj_item_stat_ix")
   private BigInteger ix;

   @NotNull
   @CatCode
   @Column(name = "cat_code")
   private String objectItemStatusCategoryCode;

        ...

}

public class AbstractObjectItemStatusId implements Serializable
{
    private static final long serialVersionUID = 1L;
   
    private BigInteger objItem;
    private BigInteger ix;

    public AbstractObjectItemStatusId() {
    }

    ...

}



Someone could help me to fix it?

Thx!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.