現在我理解到數據庫表映射我們添加:表未映射?
@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 –