Hey!

I try to test JPA features, so I currently try embedded Objects.

Entity User


@Entity
@SuppressWarnings("serial")
public class UserDO implements Serializable {

        @Id
        @GeneratedValue(strategy=GenerationType.IDENTITY)
        protected Long id;

        protected String nickname;
        protected Email email;
        protected Date lastLogin;

        @Embedded
        protected Adress adress;

        public UserDO() {
        }
....
}

I added a Adress Object.

@Embeddable
public class Adress {

        protected String street;
        protected String town;
   ...
}


Everything works fine and if i get a user and to user.getAdress() I
get the correct Object.

But when I need maybe 1000 Users... How is the best pratice...
currently I use this code:

List<UserDO> data = new ArrayList<UserDO>();

                EntityManager em = EMF.get();
                try {
                 Query query = em.createQuery( "SELECT e from " +
UserDO.class.getName() + " e" );
                 data.addAll( query.getResultList() );
                 for(UserDO u : data) {
                         u.getAdress();
                 }
                } finally {
                        em.close();
                }

Is there no way to say... load this object everytime I receive the
UserDO?

Thanks for help!

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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?hl=en.

Reply via email to