MySQL Forums
Forum List  »  NDB clusters

Failed to persist object through ClusterJPA
Posted by: Lu Boying
Date: July 07, 2014 01:52AM

I tried to persist a simple object into MySQL cluster DB through ClusterJPA following the instructions at http://planet.mysql.com/entry/?id=24140

I got following error when trying to persist the object:
-connector-java-5.1.31 ( Revision: alexander.soklakov@oracle.com-20140520065950-groqzzbvxprqdmnz ).
Exception in thread "main" <openjpa-2.3.0-r422266:1540826 fatal store error> org.apache.openjpa.persistence.RollbackException: The transaction has been rolled back. See the nested exceptions for details on the errors that occurred.
at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:594)
at TestClusterJPA.main(TestClusterJPA.java:34)
Caused by: <openjpa-2.3.0-r422266:1540826 fatal general error> org.apache.openjpa.persistence.PersistenceException: The transaction has been rolled back. See the nested exceptions for details on the errors that occurred.
at org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2370)
at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2207)
at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:2105)
at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:2023)
at org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:81)
at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1528)
at org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:933)
at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:570)
... 1 more
Caused by: com.mysql.clusterj.ClusterJFatalInternalException: Operation partitionKeySetPart is not supported for non-key fields.
at com.mysql.clusterj.core.metadata.AbstractDomainFieldHandlerImpl$27.partitionKeySetPart(AbstractDomainFieldHandlerImpl.java:2387)
at com.mysql.clusterj.core.metadata.AbstractDomainFieldHandlerImpl.partitionKeySetPart(AbstractDomainFieldHandlerImpl.java:392)
at com.mysql.clusterj.openjpa.NdbOpenJPADomainTypeHandlerImpl.createPartitionKey(NdbOpenJPADomainTypeHandlerImpl.java:578)
at com.mysql.clusterj.core.SessionImpl.setPartitionKey(SessionImpl.java:264)
at com.mysql.clusterj.core.SessionImpl.insert(SessionImpl.java:428)
at com.mysql.clusterj.openjpa.NdbOpenJPAStoreManager.flush(NdbOpenJPAStoreManager.java:375)
at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:131)

I use apache-openjpa 2.3.0 + mysql-connector-java-5.1.31.tar.gz
and here is the definition of my test class:
@Entity(name = "Project")
public class ProjectJPA {
private Long Id;
private String tenantOrg;
private int quotaGB;
private int quotaEnabled;

@Id
Long getId() {
return Id;
}

void setId(Long id) {
Id = id;
}

@Column(name="tenantOrg")
String getTenantOrg() {
return tenantOrg;
}

void setTenantOrg(String tenant) {
tenantOrg = tenant;
}

@Column(name="quotaGB")
int getQuotaGB() {
return quotaGB;
}

void setQuotaGB(int quota) {
quotaGB = quota;
}

@Column(name="quotaEnabled")
int getQuotaEnabled() {
return quotaEnabled;
}

void setQuotaEnabled(int enabled) {
quotaEnabled = enabled;
}

@Override
public String toString() {
StringBuilder builder = new StringBuilder("ProjectJPA:\n");
builder.append("Id=");
builder.append(getId());
builder.append("\n");

builder.append("tid=");
builder.append(getTenantOrg());
builder.append("\n");

builder.append("guotaGB=");
builder.append(getQuotaGB());
builder.append("\n");

builder.append("guotaEnabled=");
builder.append(getQuotaEnabled());
builder.append("\n");

return builder.toString();
}
}

Why I get this error and how can I set the log level so i can get more log info from ClusterJ?

Thanks a lot.

Options: ReplyQuote


Subject
Views
Written By
Posted
Failed to persist object through ClusterJPA
2346
July 07, 2014 01:52AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.