how to force ejb3 to reload value from data base and not use those of the context

Posted by Kohan95 on Stack Overflow See other posts from Stack Overflow or by Kohan95
Published on 2010-12-24T19:40:56Z Indexed on 2010/12/25 8:54 UTC
Read the original article Hit count: 226

Filed under:
|
|
|

Hello here I have a big problem that I hope to find help here I have two entities

@Entity

@Inheritance(strategy=InheritanceType.JOINED)

@DiscriminatorColumn(name="Role", discriminatorType=DiscriminatorType.STRING) public class Utilisateur implements Serializable {

private static final long serialVersionUID = 1L;

@Id

@GeneratedValue(strategy = GenerationType.IDENTITY)

@Column(name="id")
private Long id;
@Column(name="nom",nullable=false)
private String nom;


@Column(name="Role",nullable=false, insertable=false)
private String Role ;

//... }

@Entity

@Table(name="ResCom") @DiscriminatorValue("ResCom") public class ResCom extends Utilisateur {

/...

}

the first thing I do

ResCom rsCom= new ResCom(nom,prenom, email,civilite,
                     SysQl.crypePasse(pass));
 gr.create(rsCom);

I check my database I see that property is ResCom insert

but when I check the value of role I get null

 Utilisateur tets= gr.findByEmail(email);

    message=tets.getEmail()+" and Role :"+tets.getRole()+"";

but in my bass it ResCom !!!!!

alt text

the problem disappears when I deploy the project again

I hope you have a solution

And thank you in advance

sorry for my English

© Stack Overflow or respective owner

Related posts about jpa

Related posts about java-ee