[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Invalid identifier upon saving of an entity with Composite k
j2ee4cxw
do-not-reply at jboss.com
Mon Aug 25 08:44:13 EDT 2008
I have following entity which has composite primary keys:
@Entity
@Table(name="TM_X_CD_X_TYPE", schema="APPL_DEV")
@IdClass(TemplateXPCodeXTypePK.class)
public class TemplateXPCodeXType implements Serializable {
@Id
@Column(name="TEMPLATE_ID")
private long templateId;
@Id
@Column(name="PP_CODE_ID")
private long ppCodeId;
@Id
@Column(name="PT_CODE")
private String planTypeCode;
public TemplateXPCodeXType(){}
public TemplateXPCodeXType(long templateId, long ppCodeId,String planTypeCode)
{
this.ppCodeId = ppCodeId;
this.planTypeCode = planTypeCode;
this.templateId = templateId;
}
//getters and setters
}
Here is the Id class:
public class TemplateXPCodeXTypePK implements Serializable {
private long templateId;
private long ppCodeId;
private String planTypeCode;
public TemplateXPCodeXTypePK(){}
public TemplateXPCodeXTypePK(long templateId,long ppCodeId,String planTypeCode)
{
this.templateId = templateId;
this.ppCodeId = ppCodeId;
this.planTypeCode= planTypeCode;
}
public boolean equals(Object obj)
{
if(obj == null) return false;
if(obj == this) return true;
if(!(obj instanceof TemplateXPCodeXTypePK)) return false;
TemplateXPCodeXTypePK pk = (TemplateXPCodeXTypePK)obj;
if(templateId !=pk.getTemplateId()) return false;
if(ppCodeId != pk.getPpCodeId()) return false;
if(!planTypeCode.equals(pk.getPlanTypeCode())) return false;
return true;
}
public int hashCode()
{
return (int)templateId + (int)ppCodeId + planTypeCode.hashCode();
}
//getters and setters
}
Upon saving of TemplateXPCodeXType entity bean, I always get the following Invalid Identifier error:
Caused by: org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:515)
... 171 more
Caused by: java.sql.BatchUpdateException: ORA-00904: "PLANTYPECODE": invalid identifier
at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10720)
at org.jboss.resource.adapter.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:519)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
Any help is greatly appreciated. Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4172288#4172288
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4172288
More information about the jboss-user
mailing list