Try adding @Basic.  More info here:
http://code.google.com/appengine/docs/java/datastore/usingjpa.html#Class_and_Field_Annotations

On Tue, Dec 15, 2009 at 11:55 PM, Compi <lauwers....@gmail.com> wrote:

> Hey Everyone,
>
> I can't seem to get this working.  How do you save and read
> com.google.appengine.api.datastore.Text in google appengine with JPA,
> NOT JDO!!
>
> I have a simple POJO (Simplified example):
>
> import javax.persistence.Entity;
> import javax.persistence.GeneratedValue;
> import javax.persistence.GenerationType;
> import javax.persistence.Id;
>
> import com.google.appengine.api.datastore.Text;
>
> @Entity
> public class NewsItem implements Serializable {
>        @Id
>        @GeneratedValue(strategy = GenerationType.IDENTITY)
>        private Long id;
>        private Text content;
>        private Date created;
>        private String title;
>        private String user;
>
>        public NewsItem(Text content, Date created, String title, String
> user) {
>                super();
>                this.content = content;
>                this.created = created;
>                this.title = title;
>                this.user = user;
>        }
>
>        public Text getContent() {
>                return content;
>        }
>
>        public void setContent(Text content) {
>                this.content = content;
>        }
> }
>
>
> Which I save in my dao:
>
> @Repository("newsItemDao")
> @Transactional
> public class NewsItemDao implements Dao<NewsItem> {
>        private EntityManager entityManager = EMF.getEntityManager();
>
>
>        @Override
>        public void save(NewsItem entity) {
>                EntityTransaction tx = entityManager.getTransaction();
>                tx.begin();
>                entityManager.persist(entity);
>                entityManager.flush();
>                clearCache();
>                tx.commit();
>        }
> }
>
>
>
> But in my dashboard I can't find the content, so I think it's not
> saved, and so I can't retrieve it.
>
> Can someone help me.
>
> Thx
> Compi
>
> --
>
> 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
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2bunsubscr...@googlegroups.com>
> .
> 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 google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.


Reply via email to