[appengine-java] Re: OneToOne bidirectional relation JPA: When retreiving a child object, a parent attribute is being retrieved with its attributes in null.
Hey Jean. I did what you said, with no success. But I saw that en employee attribute retrieved by contactInfo has all its element in null but its Id. Any clue why GAE does this. Why when fetching a child object, I can retreive its parent's Id only and not the rest of its attributes. Regards. -- Kido. -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/PAUuPHebXRYJ. To post to this group, send email to google-appengine-java@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.
[appengine-java] OneToOne bidirectional relation JPA: When retreiving a child object, a parent attribute is being retrieved with its attributes in null.
Dear All. I need a help here. I may be misunderstanding something. I have 2 classes Employee and ContactInfo. in a bidirectional OneToOne relation. Being Employee the owner side. When retrieving an employee the attribute contactInfo is okay, but when I retreive a particular contactInfo. The attribute employee is null. Here are the classes: @Entity @Table(name = employee) public class Employee implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Basic private String firstName; @Basic @OneToOne(cascade = CascadeType.ALL) private ContactInfo contactInfo; public Employee() { super(); this.contactInfo = new ContactInfo(); } //getters and setters... @Entity @Table(name = contact_info) public class ContactInfo implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key key; private String mobNumber; @Basic @OneToOne(mappedBy = contactInfo) private Employee employee; public ContactInfo() { super(); } //getters and setters //Method to retreive contactInfo By Mobile Number public ContactInfo loadContactInfoByMobNumber(String mobNumber) throws NullParameterException, GeneralException { entityManager = EMF.get().createEntityManager(); ListContactInfo list; ArrayListContactInfo contactInfos; if (mobNumber == null) { throw new NullParameterException( Parameter aniId cant be null in method loadAnnotationById); } try { String sql = SELECT ci FROM ContactInfo ci WHERE ci.mobNumber=' + mobNumber + '; list = entityManager.createQuery(sql).getResultList(); contactInfos = new ArrayListContactInfo(list); } catch (Exception e) { throw new GeneralException( Exception in method loadAnnotationById: + e.getMessage()); } finally { if (entityManager.isOpen()) { entityManager.close(); } } return contactInfos.get(0); -- this object has an attribute employee in null :('. } Thenk you very much in advance. Regards. -- Kido. -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/WFtOxs1dupUJ. To post to this group, send email to google-appengine-java@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.
[appengine-java] Re: Erro em Arquivo JSP
Are you using Eclipse?. If thats the case, go to Window---Preference---Java--- Installed JREs and point to your JKD_HOME rather than the jre. Hope this helps. -- Kido. -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/Eobo-bsVrg0J. To post to this group, send email to google-appengine-java@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.
[appengine-java] User Managment System
Hello. I am currently developing a program for my university, it is almost finished (the first part), and I am dealing with User administration and so. I haven't ever developed a user administration, so I am a bit scared. I 've research and it's all about permissions and roles and group of users. Can you please recommend me a nice place to read about users in GAE. The technologies I am using now are: GWT and GAE. For what I've read the GAE user authentication with openID, allows user to enter to your app. But what If I want diferent Roles in my app (5 types of roles). How can I do it?. Sorry if the question is silly, but I do not know. Guide me on this. Thank you a lot in advance. Kido. -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/l84c4jO1-8UJ. To post to this group, send email to google-appengine-java@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.
[appengine-java] Persisting an Object that has a List of anotherObject JPA (it's been 5 days now ).
Hello. Here's the problem. An 'Annotation' has a list of 'Tag'. What I want to do is when persisting an annotation (with its list of Tag) I dont want to persist the Tags of the annotations. For example, lets say I previously persisted 3 tags: Tag1 Tag2 Tag3. And now I persist an annotations with a list of tag: Tag1 and Tag2. In the table Tag will appear: Tag1, Tag2,Tag3,Tag1,Tag2. Here's the code: @Entity @Table(name = annotation) public class Annotation implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key id; @Basic @OneToMany(mappedBy = annotation, cascade = CascadeType.ALL) private ArrayListAnnotationHasTag annotationHasTags; //setters and getters @Entity @Table(name = annotation_has_tag) public class AnnotationHasTag implements Serializable, IsSerializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key id; @Basic @ManyToOne private Annotation annotation; @Basic @ManyToOne private Tag tag; //setters and getters @Entity @Table(name = tag) public class Tag implements Serializable, IsSerializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key id; @Basic private String name; //setters and getters. Please Help me out, It's been 5 days now. I'm stuck. I'll try any kind of suggestions. Thank you in advance. Kido. -- 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-java@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.
[appengine-java] Can only reference properties of a sub-object if the sub-object is embedded
Hello. I am facing a huge problem now. I want to SELECT a FROM AClass a WHERE a.object.attribute. I am always catching this exception: Can only reference properties of a sub-object if the sub-object is embedded. I do not know what to do. Here are my classes: @Entity @Table(name = annotation) public class Annotation implements Serializable, IsSerializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key id; private String bookId; private Integer pageNumber; @Basic @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY) private AnnotationType annotationType; // setters and getters @Entity @Table(name = annotation_type) public class AnnotationType implements Serializable, IsSerializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key id; @Basic private String name; @Basic @OneToMany(cascade = CascadeType.ALL, mappedBy = annotationType) private ArrayListAnnotation annotations; //setters and getters String sql = SELECT a FROM Annotation a WHERE a.annotationTypeName=' + annotationType2.getName() + '; annotations2 = (ListAnnotation) entityManager.createQuery(sql).getResultList(); exception: Can only reference properties of a sub-object if the sub-object is embedded. Thank you a lot. Kido. -- 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-java@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.
[appengine-java] JPA fetching class.anotherClass.attribute
Hello, I am currently working for a university project about digital humanities, basically its an app where you can read books and make and share annotations to it. Im facing a problem that got me stuck for 4 days long now, and I do not know what to do. Here is the tech spec: Annotatio: has many AnnotationType. Lets say that I have to AnnotationTypes i.e ''sadness and tradegy. Then the app administrator realises that both AnnotationType are the same so he wants to merge sadness and tradegy to be AnnotationType tradegy only. So in order to make this my approach is to first grab all the annotations whose annotationType.getName() == comedy and then set the new AnnotationType in the whole list. here's the code. @Entity @Table(name = annotation) public class Annotation implements Serializable, IsSerializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key id; private String bookId; @Basic @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY) private AnnotationType annotationType; } @Entity @Table(name = annotation_type) public class AnnotationType implements Serializable, IsSerializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key id; private String name; @Basic @OneToMany(cascade = CascadeType.ALL,mappedBy = annotationType) private ArrayListAnnotation annotations; } And heres the method fusionAnnotationType public int fusionAnnotationTypes(AnnotationType annotationType1, AnnotationType annotationType2) throws GeneralException, AnnotationTypeNotFoundException, NullParameterException { int total = 0; ListAnnotation annotations2 = new ArrayListAnnotation(); ListAnnotationType annotationTypes2; entityManager = EMF.get().createEntityManager(); if (annotationType1 == null || annotationType2 == null) { throw new NullParameterException(Parameter cant be null in method deleteDnServices); } try { String sql2 = SELECT a FROM Annotation a WHERE a.annotationType + annotationType2; annotations2 = entityManager.createQuery(sql2).getResultList(); AnnotationType auxAnnotationType = new AnnotationType(); for (int i = 0; i annotations2.size(); i++) { annotations2.get(i).setAnnotationType(annotationType1); saveAnnotation(annotations2.get(i)); } } catch (Exception e) { entityTransaction.rollback(); throw new GeneralException(Exception in method fusionAnnotationTypes: + e.getMessage()); } finally { if (entityManager.isOpen()) { entityManager.close(); } } return total; } when executing it jumps this message error: Portion of expression could not be parsed: @164a05d I have also tried to fetch SELECT a FROM Annotation a WHERE a.annotationType.name + annotationType2.getName(); and annother exception occured: Can only reference properties of a sub-object if the sub-object is embedded. Can you please help me out on this, I really do not know what to do. another thing that I also tried was fetching the AnnotationType and then getting its annotationList and do the same project, but it complains again throwing another exception about entity groups. I really need some help. cheers. Kido. -- 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-java@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.
[appengine-java] can't retreive one-to-may objetcs, JPA
I cannot retreive the Listsubjects from book. The save and update of a book when a subject changes its fine, the problem is when retreiving books, It doeesnt retreive their subjects. I need help. Here;s the code. @Entity @Table(name = book) public class Book implements Serializable, IsSerializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key id; private String bookName; private String comment; @OneToMany(mappedBy=book,cascade = CascadeType.ALL) private ListSubject subjects; //setters and getters -- @Entity @Table(name = subject) public class Subject implements Serializable, IsSerializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key id; private String name; private int visible; @Basic private Text content; @Basic @ManyToOne private Book book; // setters and getters public ListBook getBooks() throws GeneralException, BookNotFoundException, NullParameterException { entityManager = EMF.get().createEntityManager(); ListBook list; try { String sql = SELECT b FROM Book b; list = entityManager.createQuery(sql).getResultList(); //this list is retreived with the books but without their subjects } catch (Exception e) { throw new GeneralException(Exception in method getBookes: + e.getMessage()); } finally { if (entityManager.isOpen()) { entityManager.close(); } } if (list == null || list.isEmpty()) { throw new BookNotFoundException(Book not found in method getBookes); } return list; } Please, I need some help. Cheers. -- Kido. -- 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-java@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.
[appengine-java] How to store appengine.api.datastore.Text using GWT (RCP)
Hi, Im trying to store a pojo Book that has a com.google.appengine.api.datastore.Text attribute, wich GWT cannot compile. Ho can I store that pojo to the datastore then?. I wish that class was in the server side, but if I do that then I cannot imported from the client side. I'm quiet stuck. Thank you for your help. -- kido. -- 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.
[appengine-java] The import com.google.appengine cannot be resolved
Hey I'm stuck at something, I just wanted to use the com.google.appengine.Text, so I can store an any sized String into the Datastore. But when compiling I receive this error: The import com.google.appengine cannot be resolved. I read in another forum a workaround when using com.google.appengine.Key. But they provided the code for the class Key, something I do not have for Text. I need some help. Thank you in advanced. -- Kido. -- 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.
[appengine-java] RCP methods behaves weirdly.
Hello, I'm doing a project where in the interface shows a listBox that includes the names of some books, the thing is that you must choose one and you will look wether in pdf or txt. My problem is that when changing the listbox, itll show the just last book you chose, rather the current one. heres the program so far. http://kido180020783.appspot.com/ Here's the part of the code that presents the problem. setCurrentBook(bookList. getItemText(bookList.getSelectedIndex())); if (pdfFlag) { if (!txtFlag) { pdfBook.setSize(booksPanelWidth, booksPanelHeight); } else { booksPanelWidth = String.valueOf(BOOKS_PANEL_WIDTH / 2); pdfBook.setSize(booksPanelWidth, booksPanelHeight); txtBook.setSize(booksPanelWidth, booksPanelHeight); } pdfBook.setUrl(pdf/ + currentBook.getUriPath() + .pdf); } else { .. //This method is being called AFTER the line pdfBook.setUrl(pdf/ + currentBook.getUriPath() + .pdf); wich is weird!!. public void setCurrentBook(String bookName) { AsyncCallbackBook callback = new AsyncCallbackBook() { public void onFailure(Throwable caught) { throw new UnsupportedOperationException(Not supported yet.); } public void onSuccess(Book result) { currentBook = result; } }; bookServicesHolder.loadBookByName(bookName, callback); } I dont want the method to be Asyncronous, please I really need some help PS: The program also have a bug on saving books everytime you reload the page, but do not pay attention to it. I cud fix that. But the weird behaviour is driving me crazy I really need some help. -- 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.
[appengine-java] Cant retrieve a list of objects when using GAE and JPA.
Hey I just want to retrieve a list of subjects, and I receive this exception: GRAVE: javax.servlet.ServletContext log: Exception while dispatching incoming RPC call com.google.gwt.user.client.rpc.SerializationException: Type 'org.datanucleus.store.appengine.query.StreamingQueryResult' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. Here's the implementation of the method I called in RCP, aswell as the entity class and the method call. (server side) -- public ListSubject getSubjects() throws SubjectNotFoundException, NullParameterException, GeneralException { ListSubject list; try { String sql = SELECT p FROM Subject p; list = entityManager.createQuery(sql).getResultList(); } catch (Exception e) { throw new GeneralException(Exception in method getSubjectes: + e.getMessage()); } if (list == null || list.isEmpty()) { throw new SubjectNotFoundException(Subject not found in method getSubjectes); } return list; } (client side) -- @Entity @Table(name = subject) public class Subject implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; private String content; private int visible; ...setters and getters.. } and here's when I call the method ( in the onload() ). AsyncCallbackListSubject callback = new AsyncCallbackListSubject() { public void onFailure(Throwable caught) { throw new UnsupportedOperationException(Not supported yet.); } public void onSuccess(ListSubject result) { subjectToString.setText(se cargaron todos los temas); } }; crudEJB.getSubjects(callback); Please I need some help. Ive read a workaround with DTO, but its not well explained, besides everybody complains is a bad habit to do it that way (the threads I found were talked 2 years ago, there must be something better nowadays) Cheers. Kido -- 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.
[appengine-java] GWT and GAE debugging problem
Hey. Im starting with GAE, and im making an RCP program (a book address), on the server side I've got all the methods for manipulating the datastore (I'm using JPA), and on the client side I'm using GWT as a framework. When debugging it turns out, that I can only see the server side, and program never stops in any breakpoint on the client side. Is there any way that I can debug on both side sas the program runs. Because, just debugging on the server side is not very helpful. Thank you in advanced for your recomendation. Kido. -- 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.
[appengine-java] GWT Designer for NetBeans
Hey, is there any gwt designer for NetBeans out there?. It would be nice to place all the design and receive automatically the code for it. I have read theres a plugin for Eclipse but I can't find anything for NetBeans. Any sugestion?. Cheers. Kido. -- 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.
[appengine-java] Can't save an object into the Datasore (JPA)
Hey I'm new at this, I just want to use the Google datastore, I made a persistence object but when it comes to save it to the datastore an exception is caught saying No environment variable is registered for this thread. When debugging the exception is thrown on the line the entityTransaction.begin(); I'm using NetBeans and JPA. I havent found yet an example where a persistent object is save to the datastore. Please it's been 5 days since I have been trying to save something to the datastore. I really need some help. Thank you in advanced. Kido. -- 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.