> Are you saying that without your ImprovedMappingDefaults class, everything is working okay?
Yes. Also just checked that if I use ImprovedMappingDefaults class, but comment out all methods so it doesn't override anything, it works fine. > Dumb question, are you sure your persistence.xml that has the SynchronizeMappings property is in use? Yes, sure :) Just double-checked with using Trace for all logging. > You could turn on Trace and check to see if the tables are maybe being created under a different schema, or some other processing that is unexpected or not consistent. In fact, tables are _not_ created at all. (I should have mentioned it before, but I already had SQL=Trace for testing). Looking at JUnit panel has shown something interesting. Don't know why it wasn't present in the console output, but there is a different exception there: <openjpa-2.2.0-r422266:1244990 fatal user error> org.apache.openjpa.persistence.ArgumentException: Errors encountered while resolving metadata. See nested exceptions for details. at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:668) at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:411) at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:384) at org.apache.openjpa.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:355) at org.apache.openjpa.jdbc.meta.MappingTool.getMapping(MappingTool.java:682) at org.apache.openjpa.jdbc.meta.MappingTool.buildSchema(MappingTool.java:754) at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:652) at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:154) at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:164) at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:122) at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:209) at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156) at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227) at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154) at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60) at ru.focusmedia.odp.server.datastore.jpa.repository.RepositoryTest.setEM(RepositoryTest.java:104) 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: <openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: The column "version" in a unique constraint in "ru.focusmedia.odp.server.datastore.jpa.entity.OdpObjectClassEntity" on table "object_classes" can not be found in the list of available columns "[ID, ABSTRACT, "display_name", "internal", NAME, PROVIDER_KIND, "provider_name", "version", SUPERCLASS]". at org.apache.openjpa.jdbc.meta.ClassMappingInfo.getUniques(ClassMappingInfo.java:520) at org.apache.openjpa.jdbc.meta.ClassMapping.resolveMapping(ClassMapping.java:873) at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1802) at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:822) at org.apache.openjpa.meta.MetaDataRepository.resolveMapping(MetaDataRepository.java:777) at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:657) ... 41 more What's up with the last exception? Why can't it find a column in the list which clearly includes it? Here's the entity class, in case it helps: package ru.focusmedia.odp.server.datastore.jpa.entity; import java.io.Serializable; import java.util.Collections; import java.util.List; import java.util.Map; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.MapKey; import javax.persistence.OneToMany; import javax.persistence.PostLoad; import javax.persistence.Table; import javax.persistence.Transient; import javax.persistence.UniqueConstraint; import ru.focusmedia.odp.server.datastore.api.objects.OdpObjectClassRecord; import ru.focusmedia.odp.server.datastore.jpa.repository.Transform; import ru.focusmedia.odp.server.objects.api.Attribute; import ru.focusmedia.odp.server.objects.api.BooleanAttribute; import ru.focusmedia.odp.server.objects.api.DateAttribute; import ru.focusmedia.odp.server.objects.api.DoubleAttribute; import ru.focusmedia.odp.server.objects.api.LongAttribute; import ru.focusmedia.odp.server.objects.api.OdpObjectClass; import ru.focusmedia.odp.server.objects.api.OdpObjectClassProviderData; import ru.focusmedia.odp.server.objects.api.OdpObjectClassProviderData.ClassProviderKind; import ru.focusmedia.odp.server.objects.api.StringAttribute; import com.google.common.collect.ImmutableList; import com.google.common.collect.Maps; @SuppressWarnings("serial") @Entity @Table(name = "object_classes", uniqueConstraints = @UniqueConstraint(columnNames = { "name", "version" })) public class OdpObjectClassEntity implements Serializable, OdpObjectClassRecord { @Id @Column(name = "id", nullable = false) @GeneratedValue private Long id; private int version; @ManyToOne @JoinColumn(name = "superclass") private OdpObjectClassEntity superClass; @Column(name = "name", nullable = false, length = 128) private String name; private String displayName; @OneToMany(mappedBy = "objectClass", cascade = { CascadeType.PERSIST, CascadeType.REMOVE }, fetch = FetchType.EAGER) @MapKey(name = "name") private Map<String, StoredAttributeEntity> storedAttributes; @Column(name = "abstract", nullable = false) private boolean _abstract; @Column(nullable = false) private boolean internal; @Enumerated(EnumType.STRING) @Column(name = "provider_kind", nullable = false) private ClassProviderKind providerKind; private String providerName; @Transient private OdpObjectClass objectClass; public OdpObjectClassEntity() { super(); } // FIXME doesn't support calculable attributes public OdpObjectClassEntity(String name, int version, OdpObjectClassEntity superClass, boolean _abstract, boolean internal, List<Attribute> attributes, ClassProviderKind providerKind, String providerName) { super(); this.version = version; this.superClass = superClass; this.name = name; this._abstract = _abstract; this.internal = internal; this.providerKind = providerKind; this.providerName = providerName; this.storedAttributes = Maps.newHashMapWithExpectedSize(attributes.size()); for (Attribute attr : attributes) { StoredAttributeEntity attrEntity; if (attr instanceof BooleanAttribute) { BooleanAttribute attr1 = (BooleanAttribute) attr; attrEntity = new BooleanAttributeEntity(attr1, this); } else if (attr instanceof DoubleAttribute) { DoubleAttribute attr1 = (DoubleAttribute) attr; attrEntity = new DoubleAttributeEntity(attr1, this); } else if (attr instanceof DateAttribute) { DateAttribute attr1 = (DateAttribute) attr; attrEntity = new DateAttributeEntity(attr1, this); } else if (attr instanceof LongAttribute) { LongAttribute attr1 = (LongAttribute) attr; attrEntity = new LongAttributeEntity(attr1, this); } else if (attr instanceof StringAttribute) { StringAttribute attr1 = (StringAttribute) attr; attrEntity = new StringAttributeEntity(attr1, this); } else { throw new IllegalArgumentException("StoredAttribute " + attr.getName() + " has unknown class: " + attr.getClass().getName()); } this.storedAttributes.put(attrEntity.getName(), attrEntity); } } public Long getId() { return id; } public String getName() { return name; } public Map<String, StoredAttributeEntity> getAttributes() { return Collections.unmodifiableMap(storedAttributes); } @Override public OdpObjectClass getObjectClass() { if (objectClass == null) { OdpObjectClass superObjectClass = superClass != null ? superClass .getObjectClass() : null; objectClass = new OdpObjectClass(name, version, superObjectClass, _abstract, internal, ImmutableList.<Attribute> copyOf(Transform.attributes(storedAttributes).values())); } return objectClass; } @Override public String toString() { return "OdpObjectClassEntity [id=" + id + ", name=" + name + ", version=" + version + "]"; } @Override public OdpObjectClassProviderData getClassProvider() { return new OdpObjectClassProviderData(providerKind, providerName); } public StoredAttributeEntity getAttribute(String attrName) { return storedAttributes.get(attrName); } @PostLoad public void ensureInitialized() { getObjectClass(); } public OdpObjectClassEntity getSuperClass() { return superClass; } public String getDisplayName() { return displayName != null ? displayName : name; } public void setDisplayName(String displayName) { this.displayName = displayName; } } -- View this message in context: http://openjpa.208410.n2.nabble.com/Change-of-MappingDefaults-breaks-OPENJPA-SEQUENCE-TABLE-tp7580246p7580264.html Sent from the OpenJPA Users mailing list archive at Nabble.com.