Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] embedded objects with null values / second try

Hi folks,

we encounter problems with embeddables.

Lets say we have this class Purchase like in EL test suite: a class with an embedabble which itself contains a relation (currency).

@Entity

public class Purchase {

    @Id

    @GeneratedValue

    private int id;

   

    @AttributeOverride(

            name="amount",

            column=@Column(name="FEE_AMOUNT", nullable=true))

    @AssociationOverride(

            name="currency",

            joinColumns=@JoinColumn(name="FEE_ID", nullable=true)))

    @Embedded

    private Money fee;

   

    public int getId() {

        return id;

    }

   

    public Money getFee() {

        return fee;

    }

   

    public void setFee(Money fee) {

        this.fee = fee;

    }

 

In our use cases, we create Purchase with the embedded money = null (business logic says we add price later…). This should be legal because we defined all contained attributes as nullable. But we get an exception:

Exception [EclipseLink-68] (Eclipse Persistence Services - 2.1.2.v20101206-r8635): org.eclipse.persistence.exceptions.DescriptorException

  Exception Description: The value of an aggregate in object [anObject] is null.  Null values not allowed for Aggregate mappings unless "Allow Null" is specified.

 

In EL 1.x.x this worked?

How can we get things working?

 

Thanks in advance, Markus

 

 

 

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

Back to the top