[jboss-user] [JBoss Seam] - Re: Error selecting object

laxu do-not-reply at jboss.com
Wed May 2 03:03:25 EDT 2007


In a form I fill values for an Istek object and use the combobox as a lookup for its member "gorevli". I expect this mechanism to assign the selected "Uzman" object to the member "gorevli".
No stacktrace, no exceptions.

Here is the corresponding action bean IsteklerAction. I have removed a lot for clarity:


  | @Stateful
  | @Name("isteklerAction")
  | @Scope(ScopeType.SESSION)
  | public class IsteklerAction implements Serializable, IsteklerActionLocal {
  |     
  |     @PersistenceContext(type=PersistenceContextType.EXTENDED)
  |     private EntityManager entityManager;
  |     
  |     public IsteklerAction() {}
  |     
  |     @DataModel
  |     private List<Istek> isteklerList;
  |     
  |     @In(required=false) @Out(required=false)
  |     private Istek istek;
  |     
  |     @Factory("isteklerList")
  |     public void refreshIstekler(){
  |         System.out.println("refreshing istekler");
  |         isteklerList=entityManager.createQuery("from Istek i order by acilis").getResultList();
  |     }
  |     
  |     @Out
  |     private List<Uzman> uzmanlar;
  |     
  |     private void refreshUzmanlar(){
  |         uzmanlar=entityManager.createQuery("from Uzman u").getResultList();
  |     }
  |     
  |     public void refresh() {
  |         refreshIstekler();
  |         refreshUzmanlar();
  |     }
  |     
  |     public void save() {
  | 
  |         if (status=="N"){
  |             entityManager.persist(istek);
  |         } else {
  |             istek=entityManager.merge(istek);
  |         }
  |         status="V";
  |         refreshIstekler();
  |     }
  | 

And the Istek class has a member named "gorevli" which is an "Uzman".


  | @Name("istek")
  | @Scope(ScopeType.PAGE)
  | @Entity
  | public class Istek implements Serializable {
  |     @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
  |     private Long id;
  |    
  |     @ManyToOne
  |     private Uzman gorevli;
  | ...
  | }

Uzman extends Kullanici whis has the @Id field:

@Entity
  | @DiscriminatorValue(value="U")
  | public class Uzman extends Kullanici {
  |     
  |     @OneToMany(mappedBy="gorevli")
  |     private java.util.List<Istek> gorevler;
  |     
  |     @ManyToMany(mappedBy="gorevliler")
  |     private Set<Proje> sorumluluklar;
  | ...
  | }
  | 
  | ...
  | 
  | @Entity
  | @Name("kullanici")
  | @Scope(ScopeType.CONVERSATION)
  | @Role(name="login",scope=ScopeType.SESSION)
  | @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
  | @DiscriminatorColumn(name="turu",discriminatorType=DiscriminatorType.CHAR)
  | @DiscriminatorValue(value="S")
  | public class Kullanici implements java.io.Serializable {
  |     @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
  |     private Long id;
  |     private String ad;
  |     private String adSoyad;
  |     private String parola;
  | }
  | 
  | 

Best regards.
Levent

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4042294#4042294

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4042294



More information about the jboss-user mailing list