1 Reply Latest reply on Nov 30, 2007 7:48 AM by Pete Muir

    Newbie - Associated tables - How to get value and persist it

    Sart Valcerou Newbie

      Hello !

      I stuck with this problem for couple days...

      My entities are generated using seam-gen.

      My Session bean..

      package test.etest.*;
      import java.io.Serializable;
      import java.util.List;
      import javax.ejb.Remove;
      import javax.ejb.Stateful;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;
      import org.jboss.seam.annotations.Factory;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.datamodel.DataModel;
      import org.jboss.seam.annotations.datamodel.DataModelSelection;
      import test.etest.*;
      public @Stateful
      class UserActionBean implements Serializable, UserAction {
       private List<User> users;
       private User user;
       private EntityManager em;
       public String find() {
       users = em.createQuery("select u from User u").getResultList();
       if (users.size() > 0) {
       return "/action.xhtml";
       return null;
       public void count() {
       // here i need to implement action that will take float value(address.num) from Address entity bean then divide it on value(user.payment) from User entity bean and then persist it to Results table.
       public void update() {
       for (User user : users) {
       public void terminate() {
       public User getUser() {
       return user;
       public void setUser(User user) {
       this.user = user;
       public List<User> getUsers() {
       return users;
       public void setUsers(List<User> users) {
       this.users = users;

      Can anyone help me ?