现在我理解到数据库表映射我们添加:表未映射?
@Entity()
@Table(name = "test")
public class Test implements Serializable {
/** Constant - serial version UID. */
public final static long serialVersionUID = 1L;
/** Member variable - represents the "name" field. */
public String name;
}
但由于某些原因,当我做查询:
delete from test;
它给了我这个错误:
15:55:54,140 ERROR [JsonFilter] javax.ejb.EJBException: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: spa_splash_page_ad is not mapped [delete from spa_splash_page_ad]
javax.servlet.ServletException: javax.ejb.EJBException: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: spa_splash_page_ad is not mapped [delete from spa_splash_page_ad]
at com.pinksheets.common.web.servlet.DeleteSplashPageServlet.fetch(DeleteSplashPageServlet.java:30)
at com.pinksheets.common.web.servlet.DeleteSplashPageServlet.fetch(DeleteSplashPageServlet.java:17)
任何想法为什么这样做?
testValue类的代码是什么? –
测试值将只是主键的变量。 – iCodeLikeImDrunk
是的,但是如果您正在使用'@ IdClass',则您的主类中必须有匹配的成员。见http://download.oracle.com/javaee/5/api/javax/persistence/IdClass.html –