下面的类为什么不能实例化?

johnyong 2009-01-20
package com.spg.spgeoas.common.entity;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;

import com.spg.spgeoas.common.common.IEntity;

@Entity(name="rad")
@Table(name="eoas_sys_rad")
@NamedQuery(name="getRelations",query="select r.discreteness from rad r where r.role=?1")
public class RoleAndDiscreteness implements IEntity,Serializable
{
    private static final long serialVersionUID = -7347205799821324456L;

    private Integer id;
    private Role role;
    private Discreteness discreteness;
   
    @Id
    @GeneratedValue(strategy=GenerationType.TABLE)
    public Integer getId()
    {
        return id;
    }
    public void setId(Integer id)
    {
        this.id = id;
    }
   
    @ManyToOne(cascade=CascadeType.REMOVE)
    @JoinColumn(name="roleId")
    public Role getRole()
    {
        return role;
    }
    public void setRole(Role role)
    {
        this.role = role;
    }
   
    @ManyToOne(cascade=CascadeType.REMOVE)
    @JoinColumn(name="discretenessId")
    public Discreteness getDiscreteness()
    {
        return discreteness;
    }
    public void setDiscreteness(Discreteness discreteness)
    {
        this.discreteness = discreteness;
    }
    public RoleAndDiscreteness(Role role, Discreteness discreteness)
    {
        System.out.println("构造函数");
        this.role = role;
        this.discreteness = discreteness;
    }
    public RoleAndDiscreteness(){
       
    }
}

上面的类不知道为什么实例化就出错,而且还没报异常给我,大家帮忙看看,谢谢了!!
johnyong 2009-01-20
问题已经解决,谢谢大家关注!!
crycz 2009-10-20
应该是entity和table冲突了 是不是?
maglic 2011-09-08
crycz 写道
应该是entity和table冲突了 是不是?

曾经我也用这两个注解,可以实例化的。
Global site tag (gtag.js) - Google Analytics