当前位置: 代码迷 >> JBoss >> jboss seam 多对多配置,主键序列生成,错误: Could not synchronize database state with session
  详细解决方案

jboss seam 多对多配置,主键序列生成,错误: Could not synchronize database state with session

热度:2445   发布时间:2013-02-26 00:00:00.0
jboss seam 多对多配置,主键序列生成,异常: Could not synchronize database state with session
 ERROR [BasicPropertyAccessor] IllegalArgumentException in class: org.domain.jbossseamtmsoa.entity.Role, getter method of property: roleid
17:22:37,137 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of org.domain.jbossseamtmsoa.entity.Role.roleid
at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:195)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:206)
at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3619)
at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3335)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:204)
at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:241)
at org.hibernate.type.EntityType.getIdentifier(EntityType.java:430)
at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:101)
at org.hibernate.persister.collection.AbstractCollectionPersister.writeElement(AbstractCollectionPersister.java:777)
at org.hibernate.persister.collection.AbstractCollectionPersister.recreate(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
......(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
......
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:169)
... 103 more

Role.:
/**
 * Role generated by hbm2java
 */
@Entity
@Table(name = "ROLE", schema = "SEAM_TMS_OA", uniqueConstraints = @UniqueConstraint(columnNames = "ROLENAME"))
public class Role implements java.io.Serializable {

private int roleid;
private String rolename;
private String description;
private String isdelete;
private Set<OaUser> users = new HashSet<OaUser>(0);
private Set<Menu> menus = new HashSet<Menu>(0);

public Role() {
}

public Role(int roleid, String rolename) {
this.roleid = roleid;
this.rolename = rolename;
}

public Role(int roleid, String rolename, String description, String isdelete) {
this.roleid = roleid;
this.rolename = rolename;
this.description = description;
this.isdelete = isdelete;

}

@Id
@Column(name = "ROLEID", unique = true, nullable = false, precision = 8, scale = 0)
  相关解决方案