Hi all,
I have a problem with  using JPA & Google App engine

Here is my entity:

@Entity
public class UserEntity {


        public String getUserName() {
                return userName;
        }

        public void setUserName(String userName) {
                this.userName = userName;
        }

        public Timestamp getTimestamp() {
                return timestamp;
        }

        public void setTimestamp(Timestamp timestamp) {
                this.timestamp = timestamp;
        }

        private String userName;
        private Timestamp timestamp;
        /**
         *
         */
        public UserEntity() {
                // TODO Auto-generated constructor stub
        }

        public void setID(Long iD) {
                ID = iD;
        }

         @Id
         @GeneratedValue(strategy = GenerationType.IDENTITY)
        public Long getID() {
                return ID;
        }

        private Long ID;

}



I then perform  inside the code:

                    UserEntity entity = new UserEntity();
                    entity.setTimestamp(new Timestamp(System.currentTimeMillis
()));
                    entity.setUserName(user.getNickname());

                    try
                    {
                        em.getTransaction().begin();
                            em.persist(entity);
                            em.getTransaction().commit();

                    }
                    catch (Exception ex)
                    {
                        String msg = "Error in persisting user";
                        log.severe(msg);
                        writer.print(msg);
                        ex.printStackTrace();
                        return;
                        }
                    finally
                    {
                        if (em.getTransaction().isActive())
                        {
                                em.getTransaction().rollback();
                        }

                    }


And in order to select the entities , I did:

                    StringBuilder sb = new StringBuilder();
                    sb.append("select u from ");
                    sb.append(UserEntity.class.getSimpleName());
                    sb.append(" u ");
                    Query q = em.createQuery(sb.toString());
                    q.setMaxResults(5);
                    List<UserEntity> alreadyLoggedInUsers = (List<UserEntity>)
q.getResultList();


Turns out that java.sql.Timestamp is not a supported type, in contrast
to JPA with hibernate implementation (I'm using JBoss 3.2.1 GA as J2EE
server, and I can persist entities with timestamps)
What are the supported types?



--

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=.


Reply via email to