The NPE is because the SituationDA is inherited from CashBaseEntity and 
CashBaseEntity does not have Id class. JIRA 873 is open to address this issue.

Regards,
Fay


--- On Sat, 1/24/09, Drifter <[email protected]> wrote:

> From: Drifter <[email protected]>
> Subject: @MappedSuperClass Cause Null Pointer Exception in Class With IdClass
> To: [email protected]
> Date: Saturday, January 24, 2009, 4:30 AM
> Dear All .. 
> i have four fieild that exist in all tables ..i want to use
> @MapperSuperClass .I test and I found that when there is a
> extended class
> that have IdClass PCEnhancer cuase null pointer exception.
> I use OpenJPA.1.2
> in other cases there is  no problem..... in the following
> class in
> ValuableItemDA  there is no problem and everything work
> well.. but in
> SituationDA that have a IdClass it cause null pointer
> excpetion.  in
> PCEnhancer..i think i should add some extera annotation?but
> i dont know how
> solve the problem...
> 
> 
> @MappedSuperclass
> public abstract class CashBaseEntity extends BaseEntity{
> @Column(name="TRCCRUI")
>             private String createUser;
>             
>             @Column(name="TRCCRTS")
>             private Date createTime;
>             
>             @Column(name="TRCLUUID")
>             private String updateUser;
>             
>             @Column(name="TRCLUTS")
>             private Date updateTime;
>             
>             @Version
>             @Column(name="TRCVER")
>             private int version;
> //getter setter ....removed ..for short post
> 
>     }
> 
> 
> @Entity
> @Table (  name = "cc2SITUATION")
> @IdClass(SituationDA.SituationId.class)
> public class SituationDA extends CashBaseEntity{
>       
>       @Id
>       @Column(name="C2008SRL")
>       private String CashBoxPeriodSerial;
>       
>       @Id
>       @Column(name="C2012TYPE")
>       private short Type;
> 
>       public static class SituationId implements Serializable{
>               private static final long serialVersionUID = 1L;
>               public String CashBoxPeriodSerial;
>               public short Type;
>               
>               public SituationId(){
>                       
>               }
>               
>               public boolean equals(Object other){
>                       if (other instanceof SituationId) {
>                               final SituationId otherId = (SituationId)other;
>                               return (
> otherId.CashBoxPeriodSerial.equals(this.CashBoxPeriodSerial)
> &&
> otherId.Type == this.Type );
>                               }
>                               return false;   
>               }
>               
>               public int hashCode() {
>                       return super.hashCode();
>               }
>       }
> //getter setter removed for short post..
> }
> 
> 
> 
> 
> @Entity
> @Table (name = "CF2VLUITEM") 
> public class ValuableItemDA extends CashBaseEntity{
>     @Id
>     @Column(name="C2001COD")
>     private short Code;
> 
> //getter setter removed for short post..
> 
> }
> 
> -- 
> View this message in context:
> http://n2.nabble.com/%40MappedSuperClass-Cause-Null-Pointer-Exception-in-Class-With-IdClass-tp2208581p2208581.html
> Sent from the OpenJPA Users mailing list archive at
> Nabble.com.


      

Reply via email to