openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dick <michael.d.d...@gmail.com>
Subject Re: How can I prevent A child in one-to-one getting persisted/merge
Date Fri, 16 Jul 2010 21:40:14 GMT
Hi,

You're getting an error because optional is set to false - try setting it to
true or removing it from the @OneToOne annotation.

-mike

On Fri, Jul 16, 2010 at 2:45 PM, Rajeev Chaudhary <veeraj21@gmail.com>wrote:

>
> How can I prevent A child in one-to-one getting persisted/merge. I only
> want
> to fetch the child information. When I am persisting FacPersonDto, I get
> error, saying the relation expects a value for the id. currently it is
> null.
> I also tried making updatabale, insertable = false in
> @JoinColumn(name="PERS_ID",referencedColumnName="PERS_ID") . But it didn't
> work. Do I need any other setting to be done in the class. Please help.
>
> public class FacPersonDto extends BaseFacPersonDto implements Serializable
> {
>        private static final long serialVersionUID = 1L;
>        @EmbeddedId
>         protected FacPersonPk facPK;
>        @Column(name="NOTE")
>        private String note;
>
>       @OneToOne(optional=false,cascade=CascadeType.REFRESH)
>       @JoinColumn(name="PERS_ID",referencedColumnName="PERS_ID")
>        private PersonDto personDto;
>
>  .....
>
> }
>
> Note: I am using javax.persistence_1.0.0.0_1-0.jar ,
> javax.transaction_1.0.0.0_1-1.jar.
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/How-can-I-prevent-A-child-in-one-to-one-getting-persisted-merge-tp5303504p5303504.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message