openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Sandor" <tms...@gmail.com>
Subject persistentCollection joinColumn name and Enum elements
Date Tue, 13 May 2008 14:10:07 GMT
Hello,

I'm using openjpa-1.1.0-SNAPSHOT-r422266:655657, as the logs show.

I have an entity like this:
@Entity
@Table(name = "CNTRY")
public class Country {

	@Id
	@Column(name = "CNTRY_ID", length = 2, nullable=false)
	private Locale countryCode;

	@PersistentCollection
	@ContainerTable(name="WCPRTY")
	@ElementColumn(name="PRICE_ID", length=3, nullable=false)
	private List<PriceType> priceTypes = new ArrayList<PriceType>();

	...
}

DDL created by mappingtool looks like this for the persistentcollection:
CREATE TABLE WCPRTY (COUNTRY_CNTRY_ID VARCHAR(2), PRICE_ID SMALLINT NOT NULL);

So, after enhancing and using mappingtool, there's still 2 issues:

1) I'd like to rename COUNTRY_CNTRY_ID to CNTRY_ID, but if use
@ContainerTable(name="WCPRTY",
joinColumns=@XJoinColumn(name="CNTRY_ID")) than the generated DDL
would declare it a VARCHAR(255) column, which is not the case.

2) PriceType is an Enumerated type. It should store element as an
EnumType.STRING instead of current SMALLINT (I guess it uses
EnumType.ORDINAL)

Is there any chance to solve these issues?
Any help is appreciated.

Thanks,
Thomas

Mime
View raw message