You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Thomas Sandor <tm...@gmail.com> on 2008/05/13 16:10:07 UTC

persistentCollection joinColumn name and Enum elements

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