Hi all
I get this exception when persisting very simple object:
Code:
org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save
The ID is auto_increment and mapped as Integer.
The DB is MySql v 5.0.41 running on winxp pro.
Any idea?
Thank you
Sharon
Code:
mysql> desc identifier;
+---------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+----------+------+-----+---------+----------------+
| IDENTIFIER_ID | int(11) | NO | PRI | NULL | auto_increment |
| NAME | char(50) | NO | UNI | | |
+---------------+----------+------+-----+---------+----------------+
2 rows in set (0.00 sec)
The entity:
Code:
@Entity
@Table(catalog="db_name", name="identifier")
public class Identifier {
private Integer identifierId;
private String name;
@Basic
@Column(name = "NAME", nullable = false, length = 50)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Id
@Column(name = "IDENTIFIER_ID", nullable = false, length = 10)
public Integer getIdentifierId() {
return identifierId;
}
public void setIdentifierId(Integer identifierId) {
this.identifierId = identifierId;
}
}
Exception:
Code:
org.apache.cxf.phase.PhaseInterceptorChain doIntercept Interceptor has thrown exception, unwinding now
pache.cxf.interceptor.Fault:
org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.company.db_name.service.beans.persistence.Idier
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:85)
at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:82)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:56)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56)
at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:87)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:206)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:67)
at org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDestination.java:100)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:224)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:137)
at org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:261)
at org.apache.cxf.transport.servlet.CXFServlet.doPost(CXFServlet.java:239)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:852)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:584)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1508)