i try to distribute entity with policy. public class JPAObjectDistributionPolicy implements DistributionPolicy {
public String distribute(Object object, List<String> slices, Object context) { return slices.get(((JPAObject) object).getDistributeFactor() % slices.size()); } } sometime it will cause error. but Data class is extend from JPAObject class. after restart websphere application server.it's will work fine. another question: after modify JPAObjectDistributionPolicy code. JPAObjectDistributionPolicy can't be changed by deploy application,must restart server. please help me. Caused by: <openjpa-2.2.1.1-SNAPSHOT-r422266:1438134 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: com.plasticmummy.ufsc20.entity.Data incompatible with com.plasticmummy.ufsc20.entity.JPAObject at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:2002) at com.ibm.ws.uow.ComponentContextSynchronizationWrapper.beforeCompletion(ComponentContextSynchronizationWrapper.java:65) at com.ibm.tx.jta.impl.RegisteredSyncs.coreDistributeBefore(RegisteredSyncs.java:291) at com.ibm.ws.tx.jta.RegisteredSyncs.distributeBefore(RegisteredSyncs.java:153) at com.ibm.ws.tx.jta.TransactionImpl.prePrepare(TransactionImpl.java:2339) at com.ibm.ws.tx.jta.TransactionImpl.stage1CommitProcessing(TransactionImpl.java:558) at com.ibm.tx.jta.impl.TransactionImpl.processCommit(TransactionImpl.java:1015) ... 81 more Caused by: java.lang.ClassCastException: com.plasticmummy.ufsc20.entity.Data incompatible with com.plasticmummy.ufsc20.entity.JPAObject at com.plasticmummy.ufsc20.common.slice.distribution.policy.JPAObjectDistributionPolicy.distribute(JPAObjectDistributionPolicy.java:12) at org.apache.openjpa.slice.SliceImplHelper.getSlicesByPolicy(SliceImplHelper.java:67) at org.apache.openjpa.slice.jdbc.DistributedJDBCStoreManager.findSliceNames(DistributedJDBCStoreManager.java:138) at org.apache.openjpa.slice.jdbc.DistributedJDBCStoreManager.bin(DistributedJDBCStoreManager.java:343) at org.apache.openjpa.slice.jdbc.DistributedJDBCStoreManager.flush(DistributedJDBCStoreManager.java:258) at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:131) at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2178) at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:2076) at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1994) ... 87 more @MappedSuperclass public abstract class JPAObject implements Serializable { private static final long serialVersionUID = 1L; public static final int ID_LENGTH = 32; @Column(length = ID_LENGTH) @Id @GeneratedValue(strategy = GenerationType.AUTO, generator = Generator.UUID_TYPE4_HEX) private String id; @Version private Long version; public static final int STATUSOFENTITY_LENGTH = 8; @Enumerated(EnumType.STRING) @Column(length = STATUSOFENTITY_LENGTH) @Index(enabled = true, unique = false) private StatusOfEntity statusOfEntity; private Integer distributeFactor; public String getId() { return id; } public StatusOfEntity getStatusOfEntity() { return statusOfEntity; } public void setStatusOfEntity(StatusOfEntity statusOfEntity) { this.statusOfEntity = statusOfEntity; } public void setId(String id) { this.id = id; } public Long getVersion() { return version; } public void setVersion(Long version) { this.version = version; } public Integer getDistributeFactor() { return distributeFactor; } public void setDistributeFactor(Integer distributeFactor) { this.distributeFactor = distributeFactor; } } @Entity @Table(name = "T_DATA", schema = "UFSC20") @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public class Data extends JPAObject { private static final long serialVersionUID = 1L; @Transient public static final int CONTENT_LENGTH = 6000; @Column(length = CONTENT_LENGTH) @Index private String content; @Transient public static final int TITLE_LENGTH = 1000; @Column(length = TITLE_LENGTH) @Index private String title; @Transient public static final int LINK_LENGTH = 1000; @Column(length = LINK_LENGTH) @Index private String link; @Transient public static final int UNID_LENGTH = 1000; @Column(length = UNID_LENGTH) @Index private String unid; @Temporal(TemporalType.TIMESTAMP) @Index private Date date; @Transient public static final int PROJECT_LENGTH = 200; @Column(length = PROJECT_LENGTH) @Index private String project; @Transient public static final int CATEGORY_LENGTH = 200; @Column(length = CATEGORY_LENGTH) @Index private String category; @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "data") private Set<ScopeUser> scopeUsers; @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "data") private Set<ScopeGroup> scopeGroups; @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "data") private Set<ScopeRole> scopeRoles; public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getLink() { return link; } public void setLink(String link) { this.link = link; } public String getCategory() { return category; } public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } public void setCategory(String category) { this.category = category; } public String getUnid() { return unid; } public void setUnid(String unid) { this.unid = unid; } public Set<ScopeUser> getScopeUsers() { return scopeUsers; } public void setScopeUsers(Set<ScopeUser> scopeUsers) { this.scopeUsers = scopeUsers; } public Set<ScopeGroup> getScopeGroups() { return scopeGroups; } public void setScopeGroups(Set<ScopeGroup> scopeGroups) { this.scopeGroups = scopeGroups; } public Set<ScopeRole> getScopeRoles() { return scopeRoles; } public void setScopeRoles(Set<ScopeRole> scopeRoles) { this.scopeRoles = scopeRoles; } public String getProject() { return project; } public void setProject(String project) { this.project = project; } } -- View this message in context: http://openjpa.208410.n2.nabble.com/Entity-incompatible-with-it-s-superclass-tp7583838.html Sent from the OpenJPA Users mailing list archive at Nabble.com.