openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From depstei2 <depst...@umd.edu>
Subject UniqueConstraint in a MappedSuperclass not working
Date Tue, 14 Apr 2009 14:23:40 GMT

Hello, I think this is a bug:

I am getting 
Caused by: <openjpa-1.2.1-r752877:753278 nonfatal user error> org.apache.openjpa.persistence.ArgumentException:
The column "ATTR_NAME" in a unique constraint in "foo.bar.Attribute" on table "null" can not
be found in the list of available columns "[]".
	at org.apache.openjpa.jdbc.meta.ClassMappingInfo.getUniques(ClassMappingInfo.java:432)
	at org.apache.openjpa.jdbc.meta.ClassMapping.resolveMapping(ClassMapping.java:857)
	at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1631)
	at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:717)
	at org.apache.openjpa.meta.MetaDataRepository.resolveMapping(MetaDataRepository.java:677)
	at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:555)
	at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:308)
	at org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepository.java:581)
	at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:541)
	at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:308)
	at org.apache.openjpa.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:285)
	at org.apache.openjpa.jdbc.meta.MappingTool.getMapping(MappingTool.java:676)
	at org.apache.openjpa.jdbc.meta.MappingTool.buildSchema(MappingTool.java:748)
	at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:646)
	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:153)
	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:119)
	at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:189)
	at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:145)

I have a class
@MappedSuperclass
@Table(uniqueConstraints={@UniqueConstraint(columnNames={"ATTR_NAME", "OWNER"})})
public abstract class Attribute<T> {
	@Id
	private String id;

	@Column(name="ATTR_NAME")
	private String name;
	
	@Column(name="ATTR_VALUE")
	private String value;

	public abstract T getOwner();
	public abstract void setOwner(T owner);

and it is extended by
@Entity
@Table(name = "ORG_ATTR")
public class OrgAttribute extends Attribute<Org> {
	@ManyToOne
	@JoinColumn(name = "OWNER")
	private Org owner;

	@Override
	public Org getOwner() {
		return owner;
	}

	@Override
	public void setOwner(Org owner) {
		this.owner = owner;
	}
}

This mapping is working in both Eclipselink and Hibernate
-- 
View this message in context: http://n2.nabble.com/UniqueConstraint-in-a-MappedSuperclass-not-working-tp2633410p2633410.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message