-
1. Re: EJb 3.0 primary key loose ?
epbernard Sep 19, 2006 7:35 PM (in response to stephan.opitz)you need to show the code for
// make persistent
customersFacade.save(customer);
local or remote bean? -
2. Re: EJb 3.0 primary key loose ?
stephan.opitz Sep 20, 2006 2:10 AM (in response to stephan.opitz)the call for my ejbs from my application is local
but at this point i'm in the ejbs and have access only access to injected ejbs
private @EJB
OrdersFacade ordersFacade;
all are stateless, except sessionFacade which i set in my application to get the correct on and have access to correct data
/**
* The SessionFacade with access to the specific ejb
*/
private SessionFacade sessionFacade = null;
// ------------------------------------------------------- Public Properties
/**
* @param sessionFacade
* The sessionFacade to set
*/
public void setSessionFacade(SessionFacade sessionFacade) {
this.sessionFacade = sessionFacade;
} -
3. Re: EJb 3.0 primary key loose ?
stephan.opitz Sep 20, 2006 2:19 AM (in response to stephan.opitz)and interface defined hier
import java.util.Date;
import de.Test.entity.Orders;
public interface OrdersFacade {
/**
* Makes a Orders object persistent
*
* @param order
* Orders object
*/
public void save(Orders order);
and statelessbean here
with mark of which interface is local and remote - both same :-/
but local isn't need is'nt it - filled i mean?
import javax.ejb.Local;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
...
import de.Test.entity.Orders;
import de.Test.facade.OrdersFacade;
@Local(OrdersFacade.class)
@Remote(OrdersFacade.class)
@Stateless
public class OrdersBean implements OrdersFacade {
@PersistenceContext(unitName = "TestPU")
private EntityManager em;
// ------------------------------------------------------ Manifest Constants
public static final String Remote = OrdersBean.class.getSimpleName()
+ "/remote";
public static final String Local = OrdersBean.class.getSimpleName()
+ "/local"; -
4. Re: EJb 3.0 primary key loose ?
epbernard Sep 20, 2006 4:41 PM (in response to stephan.opitz)save method impl?
-
5. Re: EJb 3.0 primary key loose ?
stephan.opitz Sep 22, 2006 3:47 PM (in response to stephan.opitz)/**
* Makes a Orders object persistent
*
* @param orders
* Orders object
*/
public void save(Orders orders) {
em.persist(orders);
}
needknowledge of getting id into object
additionally could i say
java persistence api is:
entity beans + entity manager + hsqldb(which was introduced by hibernate) -
6. Re: EJb 3.0 primary key loose ?
ojacobson Oct 16, 2006 8:04 PM (in response to stephan.opitz)Try this:
in the CustomerFacade:public Orders save(Orders orders) { em.persist(orders); return orders; }
Then your persist code looks like// make persistent customer = customersFacade.save(customer);