SOLVED!

I forgot to set cascade for A, so, A should look like:

class A{
@ManyToOne(optional=true, cascade=CascadeType.ALL)
private B b;
}

Thanks!

On Mar 20, 12:45 pm, Vasily <vasiliy.ru...@gmail.com> wrote:
> Hi All...
>
> I have 2 entities:
>
> class A{
> @ManyToOne(optional=true)
> private B b;
>
> }
>
> class B{
> @OneToMany(cascade=CascadeType.ALL, fetch = FetchType.LAZY,
> mappedBy="b")
> private List<A> aList = new ArrayList<A>();
>
> }
>
> I'm editing A using RequestFactory... as a part of edit, I'm:
> 1. creating a new instance of B using same RequestContext as for
> editing A;
> 2. adding current instance of A to the aList of B;
> 3. adding B to the A.b;
> 4. persisting A.
>
> It works ok when I'm persisting A.b with any existed B... in this case
> reference correctly set & persisted.
>
> I'm expecting what a new B will also be persisted & it's reference
> will be saved in A's b. But that's doesn't happen.
>
> Any ideas what's wrong?
> Thx!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to