[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.rt.eclipselink] JPA and JSP

Dear all,

I would like to use jpa on my JSP in order to manage persistance. My problem is with Entity relationship.
JavaBean on JSP allow to set/get primitive java types. So for example I can set by <input> tag on JSP a javabean property.
But if I have two Entity A and B with a relation between them (the following source is just for example...it can have sintax error..but it is just to give you an example):


@Entity
public class A {
   @Id
   private int ida;

   @OnetoOne
   private B b;

}


@Entity public class B { @Id private int idb;

   @OnetoOne
   private A a;
}

and I use this bean in the JSP:

<jsp:useBean id="a"class="A" scope="page" />
<jsp:setProperty name="a" property="*"/>

how can I set the property b of class A?
If it was a primitive type (like an int) I could:

<input type="hidden" name="b"  value="<%....%>">

but it is not a primitive type..it is an object of class B (an entity).

There is any way to use javabean entity with relationship propertis (also OneToMany...with list for example) on JSP beans?

Best Regards,
Enrico