openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From depstei2 <depst...@umd.edu>
Subject Re: UniqueConstraint in a MappedSuperclass not working
Date Wed, 22 Apr 2009 21:33:48 GMT

This works, but only if I have one subclass.  If there are two separate
subclasses of the Attribute class I get 
Constraint 'UNQ_ATTR_NAMEOWNER' already exists in Schema 'SERVICETEST'

It seems like openJpa is not naming these constraints uniquely, is there any
way to do this?


Hi ,

May be you are already aware, Workaround would be to use "unique constraint"
in sub class.
So in your example, 
@Table(uniqueConstraints={@UniqueConstraint(columnNames={"ATTR_NAME",
"OWNER"})})
will go to OrgAttribute and look like:
@Table(name =
"ORG_ATTR",uniqueConstraints={@UniqueConstraint(columnNames={"ATTR_NAME",
"OWNER"})})

I think it would be nice if the uniqueconstraint can be defined in the super
class itself.

As far as it is bug or not, may be some openJPA expert can help answer that.

According to my view, it is more of any enhancement request rather than a
bug.
My conclusion is based on following, Table annotation is for an entity class
and mappedSuperclass is a non-entity class.

Regards,
Ravi.

-- 
View this message in context: http://n2.nabble.com/UniqueConstraint-in-a-MappedSuperclass-not-working-tp2633410p2679418.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message