Hi,

I had little bit same kind of problems with Blob field that you have with
your list. When I change the blob content it didn't save.
I get it solved so that I change something in "parent entity" and did the
save after that - then it started to work.
In your case I think that if this is somehow related to my problem change
some property at your Cont class
and save it after that, this might help. In my case this change seems to
indicate the "background operations" that
something has changes.

br,
-michael

2011/1/13 Khor Yong Hao <[email protected]>

> Try em.refresh() before em.persist()
>
> On Thu, Jan 13, 2011 at 6:36 PM, frank <[email protected]> wrote:
>
>> Hello,
>>
>> I try to store an embedded List in an Entity.
>> I runs without errors, but no elements of the List are stored
>>
>> Thanks for your help.
>>
>> here is the code:
>>
>> @Entity
>> public class Cont implements Serializable
>> {private static final long serialVersionUID = 1L;
>>  @Id
>>  @GeneratedValue(strategy = GenerationType.IDENTITY)
>>  private String id;
>>  @Extension(vendorName = "datanucleus", key = "cascade-persist",
>> value = "true")
>>  @Embedded
>>  private List<Em2> em2;
>>
>>  ..
>> }
>>
>> @Embeddable
>> public class Em2 implements Serializable
>> { @Basic public String s;
>>  ...
>> }
>>
>> public static String testcode()
>> {
>>    EntityManager em = Gae.emfInstance.createEntityManager();
>>    Cont cont;
>>    List<Em2> emList = new ArrayList<Em2>();
>>    emList.add(new Em2("Element1"));
>>    emList.add(new Em2("Element2"));
>>
>>    cont=new Cont( "1");
>>    cont.setEm(new Em("TEST"));
>>    cont.setEm2(emList);
>>
>>    em.persist(cont);
>>    em.close();
>>
>>    em = Gae.emfInstance.createEntityManager();
>>    Query q = em.createQuery("select c from  Cont c");
>>    Cont read  = (Cont) q.getSingleResult();
>>
>>    System.out.println(read.getEm2().size());
>>        // -------------------
>>        // output 0
>>        // -------------------
>>
>>    em.close();
>>  }
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine for Java" group.
>> To post to this group, send email to
>> [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<google-appengine-java%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine-java?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine-java%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>



-- 
*We Create Solutions for Web and Mobile World*

email:  [email protected]
gsm:   +358 40 824 35 03
web:    www.vnetcon.org

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to