JPA 2.0 (the spec level that EclipseLink implements) has specified rules
around access type of an embeddable (see section 2.3.2 and 2.3.3). In
your use case access type of MoneyC is defaulted to FIELD as the
embedding entity uses field access. You will need to specify
@Access(PROPERTY) on MoneyC class to solve the issue.
On 10/20/2010 5:01 AM, glassfish_at_javadesktop.org wrote:
> Hi! We have an app running on Glassfish 2.1 (9.1.1). Porting it to Glassfish-v3 throws on deployment.
>
> Does org.eclipse.persistence understand annotations on get/set methods, embedded fields? Do we have to restructure/rewrite the app to go to GF-v3?
> Or can anybody suggest a "quick fix"?
>
>
> (See attachment for more log):
>
> SEVERE: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method
> javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistence.exceptions.EntityManagerSetupException
> Exception Description: Predeployment of PersistenceUnit [Webshop-ejbPU] failed.
> Internal Exception: Exception [EclipseLink-7200] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistence.exceptions.ValidationException
> [b]Exception Description: The attribute [amount] was not found on the embeddable class [class net.bawtry.bcs.entities.MoneyC]. It is referenced in an attribute override for the embedded attribute [price] on class [class net.bawtry.webshop.entities.ProductPrice].[/b]
>
> Class: [i]ProductPrice[/i] includes this declaration:
>
> @Embedded
> @AttributeOverrides(
> {_at_AttributeOverride(name="amount", column=_at_Column(name="priceAmount")),
> @AttributeOverride(name="currencyCode", column=_at_Column(name="priceCurrency"))
> })
> private MoneyC price;
>
>
> Class: [i]MoneyC[/i] annotates property get/set methods
>
>
> @Column(nullable = false)
> @Override
> protected BigDecimal getAmount() {
> return this.amount;
> }
> @Override
> protected void setAmount(BigDecimal amount) {
> this.amount = amount.abs();
> }
> [Message sent by forum member 'joerobbins']
>
> http://forums.java.net/jive/thread.jspa?messageID=485711
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>