ejb@glassfish.java.net

Re: Trying to connect to Remote ession Bean from JSF backing bean

From: Wouter van Reeven <wouter_at_van.reeven.nl>
Date: Fri, 17 Nov 2006 15:10:24 +0100

Hi Mahesh,

On Wed, Nov 15, 2006 at 08:26:20PM -0800, Mahesh.Kannan wrote:
> Forwarding this ORB team, but looks like the MarshalException is maybe
> because the entity that you are passing back is non serializable.?

Did you ever get word from the ORB team? I did some more testing and found the
problem. The CultiUser class has these mappings (leaving out the getters and
setters which were generated by NetBeans) :

@Entity
@Table(name = "USERS")
@NamedQueries({ @NamedQuery(name="CultiUser.login", query="SELECT c FROM CultiUser c WHERE c.username = :username AND c.password = :password") })
public class CultiUser implements Serializable {

    @Id
    @Column(name = "ID", nullable = false)
    private BigDecimal id;

    @Column(name = "USERNAME", nullable = false)
    private String username;

    @Column(name = "PASSWORD", nullable = false)
    private String password;

    @Column(name = "EMAIL_ADDRESS", nullable = false)
    private String emailAddress;

    @JoinColumn(name = "USERROLE_ID", referencedColumnName = "ID")
    @ManyToOne
    private CultiUserRole userroleId;

// stuff not copied and pasted
}

The CultiUserRole class has these mappings

@Entity
@Table(name = "USERROLES")
public class CultiUserRole implements Serializable {

    @Id
    @Column(name = "ID", nullable = false)
    private BigDecimal id;

    @Column(name = "USERROLE", nullable = false)
    private String userrole;

    @OneToMany(mappedBy = "userroleId")
    private Collection<CultiUser> cultiUserCollection;

// stuff not copied and pasted
}

Interestingly enough, the error doesn't occur where I comment out the userroleId
member and its annotations, getters and setters and also the cultiUserCollection
member and its annotations, getters and setters! It looks like something is
wrong with my mapping. This was generated by NetBeans based on the tables I have
in my Oracle XE database. Any idea what's going on?


Thanks, Wouter

-- 
People: "If she weighs the same as a Duck, she's made of wood!"
Sir Bedevere: "And therefore...?"