IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JPA Java Discussion :

EJB Entity Bean et problème de mapping


Sujet :

JPA Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Inscrit en
    Février 2008
    Messages
    222
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 222
    Par défaut EJB Entity Bean et problème de mapping
    Salut,

    J'ai une application web qui permet d'ajouter des documents dans une base de données, donc le nom, la date de création, l'emplacement, et une liste de modification. Je travail avec les EJB3, JBoss et postgresql.
    Tout d'abord, j'ai créé une classe document qui représente la table document dans la base de données, dont voici le code :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    @Entity
    public class Document implements Serializable{
    	// les variables correspondent aux colonnes de la table Document de la base de données
    	@Column(name = "nom", nullable = false)
    	private String nom; // le nom du document
    	@Column(name = "date_creation", nullable = false)
    	private java.util.Date date_creation; // la date de création du document
    	@Column(name = "emplacement", nullable = false)
    	private String emplacement; // l'emplacement du document
    	@Column(name = "modification", nullable = false)
    	private java.util.Set<Modification> modification; // la date de dernière modification
    	@Column(name = "tag", nullable = false)
    	private java.util.Set<Tag> tag; // la liste des tags représentant ce document
    	private static final long serialVersionUID = -728268157L; 
    	private Long id; // l'identifiant obligatoire pour la table
    	@Column(name = "typeDocument", nullable = false)
    	private TypeDocument typeDocument; // le type du document : ex technique, commercial ..
     
     
    	// le constructeur qui est vide
     
    	public Document() {
    		super();
    	}
     
     
    	// redéfinition de la méthode ToString
     
    	public String toString() {
    		return "Document" + " nom=" + nom + " date_creation=" + date_creation
    				+ " emplacement=" + emplacement + " id=" + id;
    	}
     
     
    	// les getters et setters
     
    	public String getNom() {
    		return this.nom;
    	}
     
     
    	public void setNom(String nom) {
    		this.nom = nom;
    	}
     
     
    	public java.util.Date getDate_creation() {
    		return this.date_creation;
    	}
     
     
    	public void setDate_creation(java.util.Date date_creation) {
    		this.date_creation = date_creation;
    	}
     
     
    	public String getEmplacement() {
    		return this.emplacement;
    	}
     
     
    	public void setEmplacement(String emplacement) {
    		this.emplacement = emplacement;
    	}
     
    	@OneToMany(cascade=CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "document")
    	public Collection<Modification> getModification() {
    		if (modification == null) {
    			modification = new java.util.HashSet<Modification>();
    		}
    		return modification;
    	}
     
     
    	public void setModification(java.util.Set<Modification> modification) {
    		this.modification = modification;
    	}
     
     
    	public void addModification(Modification Modification) {
    		getModification().add(Modification);
    	}
     
     
    	public void removeModification(Modification Modification) {
    		getModification().remove(Modification);
    	}
     
     
     
     
    	@ManyToMany(cascade=CascadeType.ALL, mappedBy="document", targetEntity=Tag.class)
    	public java.util.Set<Tag> getTag() {
    		if (tag == null) {
    			tag = new java.util.HashSet<Tag>();
    		}
    		return tag;
    	}
     
     
    	public void setTag(java.util.Set<Tag> tag) {
    		this.tag = tag;
    	}
     
     
    	public void addTag(Tag tag) {
    		getTag().add(tag);
    	}
     
     
    	public void removeTag(Tag tag) {
    		getTag().remove(tag);
    	}
     
    	@Id // tag définissant la clé primaire
    	@GeneratedValue(strategy=GenerationType.AUTO) // tag indiquant que la clé est auto générée
    	public Long getId() {
    		return this.id;
    	}
     
     
    	public void setId(Long id) {
    		this.id = id;
    	}
     
    	@ManyToOne
    	@JoinColumn(name = "typeDocumentID")
    	public TypeDocument getTypeDocument() {
    		return this.typeDocument;
    	}
     
     
    	public void setTypeDocument(TypeDocument typeDocument) {
    		this.typeDocument = typeDocument;
    	}
     
     
     
    }
    Vous pouvez voir en rouge qu'il y a la liste de modification donc il y a une ralation OneToMany

    Voici maintenant le code de la classe modification :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    @Entity
    public class Modification implements Serializable {
    	// les variables correspondent aux colonnes de la table Modification de la base de données
    	@Column(name = "date", nullable = false)
    	private java.util.Date date; // la date de modification
    	@Column(name = "commentaire", nullable = false)
    	private String commentaire; // le commentaire pour expliqué ce qu'il a été fait comme modification
    	@Column(name = "documentID", nullable = false)
    	private Document document; // représente le document qui a été modifié
    	private Utilisateur user; // représente le user qui a fait cette modification
    	private static final long serialVersionUID = 258313988L;
    	private Long id; // identifiant obligatoire pour la table
     
    	// redéfinition de la méthode toString
     
    	public String toString() {
    		return "Modification" + " date=" + date + " commentaire=" + commentaire
    				+ " id=" + id;
    	}
     
    	// le constructeur vide
     
    	public Modification() {
    		super();
    	}
     
    	// les getters et les setters
     
    	public java.util.Date getDate() {
    		return this.date;
    	}
     
     
    	public void setDate(java.util.Date date) {
    		this.date = date;
    	}
     
     
    	public String getCommentaire() {
    		return this.commentaire;
    	}
     
     
    	public void setCommentaire(String commentaire) {
    		this.commentaire = commentaire;
    	}
     
    	//@ManyToOne(optional=false)
    	@ManyToOne
    	@JoinColumn(name = "documentID")
    	public Document getDocument() {
    		return this.document;
    	}
     
     
    	public void setDocument(Document document) {
    		this.document = document;
    	}
     
    	@ManyToOne
    	@JoinColumn(name = "UserID")
    	public Utilisateur getUser() {
    		return this.user;
    	}
     
     
    	public void setUser(Utilisateur user) {
    		this.user = user;
    	}
     
    	@Id // tag définissant la clé primaire
    	@GeneratedValue(strategy=GenerationType.AUTO) // tag indiquant que la clé est auto générée
    	public Long getId() {
    		return this.id;
    	}
     
     
    	public void setId(Long id) {
    		this.id = id;
    	}
     
    }

    Maintenat, côté servlet je veux ajouter un nouveau document, donc dans le code je cré un document et j'appel la méthode qui se trouve dans mon session bean qui permet de faire cela.

    Voici le code de ma servlet
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    package servlet;
    
    import java.io.IOException;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import java.util.HashSet;
    import java.util.Iterator;
    import java.util.Set;
    import java.util.StringTokenizer;
    
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    import ejb.Document;
    import ejb.GestionDeDocument;
    import ejb.Modification;
    import ejb.Tag;
    import ejb.TypeDocument;
    import ejb.Utilisateur;
    
    public class AjouterDocument extends HttpServlet{
    	private String nom;
    	private Date date_creation;
    	private String emplacement;
    	private String listeTags;
    	private Set<Tag> tags ;
    	private String leType;
    	private TypeDocument type;
    	private Set<Modification> listeModification;
    	private Set<Document> listeDocument;
    	
    	// cette méthode permet de récupérer la requête envoyé par l'applet et de renvoyer la réponse
    	public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
    		// instantiation d'un nouveau document
    		Document document = new Document();
    				
    		// récupération des paramètres envoyés par l'applet
    		
    		// le nom du document
    		nom = request.getParameter("nom");
    		
    		//l'emplacement
    		emplacement = request.getParameter("emplacement");
    		
    		// la liste des tags
    		listeTags = request.getParameter("tags"); // la liste de tags envoyée par l'applet est du style tag1|tag2|tag3
    		
    		// on récupère les tags un par un
    		
    		tags = new HashSet<Tag>();
    		StringTokenizer lesTags = new StringTokenizer(listeTags);
    		while(lesTags.hasMoreTokens()){
    			Tag t = new Tag();
    			String nomTag = lesTags.nextToken();
    			t.setNom(nomTag);
    			t.setCommentaire("");
    			tags.add(t); // on ajoute le tag dans la liste
    		}
    		
    		// le type du document
    		leType = request.getParameter("type");
    		type = new TypeDocument();
    		type.setNom(leType);
    		type.setCommentaire("");
    		
    		// la date de création
    		date_creation = new Date();
    		
    		
    		// modification
    		listeModification = new HashSet<Modification>();
    	/*	Modification modif = new Modification();
    		modif.setCommentaire("ajout");
    		modif.setDate(date_creation);
    		modif.setDocument(document);
    		
    		Utilisateur user = new Utilisateur();
    		user.setInitiale("YB");
    		user.setMotDePasse("motDePasse");
    		user.setNom("Bardon");
    		user.setPrenom("Yannick");
    		user.setModification(listeModification);
    		
    		modif.setUser(user);
    		*/
    		// on construit le nouveau document avec tous les paramètres
    		
    		document.setDate_creation(date_creation);
    		document.setEmplacement(emplacement);
    		document.setModification(listeModification);
    		document.setNom(nom);
    		document.setTag(tags);
    		document.setTypeDocument(type);
    		
    		
    		// le type correspond à plusieurs document donc c'est pour cela qu'on lui met une liste de document
    		listeDocument = new HashSet<Document>();
    		listeDocument.add(document);
    		
    		type.setDocument(listeDocument);
    		
    		
    		
    		
    		// on va faire appel aux ejb
    		
    		try {
    			Context context = new InitialContext();
    			GestionDeDocument gdd = (GestionDeDocument) context.lookup("GestionDeDocumentBean/remote");
    			// ajout d'un document dans la base de données
    			gdd.ajouterDocument(document);
    			
    			// ajout du tag dans la base de données
    			// le tag correspond à plusieurs document donc c'est pour cele qu'on lui met une liste de document
    			Iterator<Tag> iterator = tags.iterator();
    			while(iterator.hasNext()){
    				Tag t = iterator.next();
    				t.setDocument(listeDocument);
    				gdd.ajouterTag(t);
    			}
    			
    			// ajout du type dans la base de données
    			gdd.ajouterType(type);
    			/*gdd.ajouterModification(modif);
    			gdd.ajouterUser(user);
    			*/
    		} catch (NamingException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
    
    		
    	}
    		
    
    }
    j'ai mis en rouge les parties importante

    Enfin une fois que je lance mon appli web via firefox, voici l'erreur que j'ai :

    type Rapport d'exception

    message
    description Le serveur a rencontré une erreur interne () qui l'a empêché de satisfaire la requête.

    exception

    javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of ejb.Document.modification
    org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
    org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
    org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
    org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
    org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterceptor.java:79)
    org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:70)
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:103)
    $Proxy81.ajouterDocument(Unknown Source)
    servlet.AjouterDocument.doGet(AjouterDocument.java:116)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

    cause mère

    javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of ejb.Document.modification
    org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
    org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
    org.jboss.ejb3.entity.TransactionScopedEntityManager.persist(TransactionScopedEntityManager.java:182)
    ejb.GestionDeDocumentBean.ajouterDocument(GestionDeDocumentBean.java:32)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:585)
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
    org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
    org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
    org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
    org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
    org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterceptor.java:79)
    org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:70)
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:103)
    $Proxy81.ajouterDocument(Unknown Source)
    servlet.AjouterDocument.doGet(AjouterDocument.java:116)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    Je ne sais pas d'où cela peut venir

    Merci pour vos réponses

  2. #2
    Membre confirmé Avatar de Rizzen
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    115
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 115
    Par défaut
    quand tu fais un persist sur ton document est ce que ton objet modif existe déjà dans la bdd ? Je veux dire par la est ce que tu l'as persister ou alors récupérer de la base ?

  3. #3
    Membre éclairé
    Inscrit en
    Février 2008
    Messages
    222
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 222
    Par défaut
    salut,

    mon objet modif je l'ai persisté, en fait grace aux annotations des ejb3, du style @ManyToOne j'ai pu créer ma base de données avec mes différentes tables, et le problème est lorsque je veux ajouter un nouveau document dans la table j'ai le problème avec le champ modification, un problème sur le setter de modification je pense d'aprés l'erreur qu'il m'affiche, et je ne sais pas d'où peut venir le problème.

  4. #4
    Membre confirmé
    Profil pro
    Inscrit en
    Novembre 2007
    Messages
    40
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2007
    Messages : 40
    Par défaut
    Hello

    Apparement, il persist un nouveau document.
    2 remarques cependant, même si je ne pense pas que ce soit la cause du problème:
    - tu mets des annotation a la fois sur les propriété (les @column) et aussi sur les getters. Je pense que ce n'est pas une bonne idée.
    - dans Document, le getter de modification renvoie un Collection alors qu'il devrait renvoyer un Set --> peut etre la cause de l'exception (même si ca m'étonnerait...)

  5. #5
    Membre éclairé
    Inscrit en
    Février 2008
    Messages
    222
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 222
    Par défaut
    Salut,

    tes 2 remarques sont intéressentes, tu préconises plutôt que je mette toutes mes annotations sur les getters donc @Column aussi, je vais essayer de changer le type de retour du getter pour modification, on ne sait jamais si sa peut venir de là

  6. #6
    Membre confirmé
    Profil pro
    Inscrit en
    Novembre 2007
    Messages
    40
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2007
    Messages : 40
    Par défaut
    Oui il vaut mieux éviter de mélanger la manière d'annoter les classes, et ce sur la totalité du projet pas seulement sur dans la même classe.

  7. #7
    Membre éclairé
    Inscrit en
    Février 2008
    Messages
    222
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 222
    Par défaut
    je viens de faire les modificatiosn et malheureusesement j'ai toujours les même erreurs, par contre j'ai une erreur sur la console window du serveur d'application qui est la suivante, que je n'avais pas vu avant

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    10:46:35,774 ERROR [BasicPropertyAccessor] expected type : java.util.Set, actual value : org.hibernate.collection.PersistentBag

  8. #8
    Membre éclairé
    Inscrit en
    Février 2008
    Messages
    222
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 222
    Par défaut
    Oups, petit rectificatif lorsque j'ai changé la valeur de retour de getter pour modification il y a eu un changement, en effet, je n'ai pas la même erreur, voici cette erreur :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
     
    java.lang.RuntimeException: javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state
    	org.jboss.aspects.tx.TxPolicy.handleEndTransactionException(TxPolicy.java:198)
    	org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:180)
    	org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
    	org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
    	org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    	org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
    	org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    	org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
    	org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    	org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
    	org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
    	org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    	org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
    	org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    	org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
    	org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    	org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
    	org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterceptor.java:79)
    	org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:70)
    	org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    	org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:103)
    	$Proxy81.ajouterDocument(Unknown Source)
    	servlet.AjouterDocument.doGet(AjouterDocument.java:116)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
     
    cause mère
     
    javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state
    	com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1267)
    	com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
    	com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
    	org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:175)
    	org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
    	org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
    	org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    	org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
    	org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    	org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
    	org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    	org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
    	org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
    	org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    	org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
    	org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    	org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
    	org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    	org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
    	org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterceptor.java:79)
    	org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:70)
    	org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    	org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:103)
    	$Proxy81.ajouterDocument(Unknown Source)
    	servlet.AjouterDocument.doGet(AjouterDocument.java:116)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    C'est parti pour faire des recherches sur le net...

Discussions similaires

  1. Réponses: 3
    Dernier message: 21/06/2012, 13h00
  2. EJB entity bean et LazyInitializationException
    Par bard123 dans le forum JPA
    Réponses: 27
    Dernier message: 13/03/2008, 17h14
  3. EJB Entity Bean
    Par bard123 dans le forum JPA
    Réponses: 10
    Dernier message: 04/03/2008, 12h36
  4. Réponses: 1
    Dernier message: 28/04/2007, 20h26
  5. problème de deploiement d'un Entity Bean CMP
    Par med56 dans le forum JOnAS
    Réponses: 1
    Dernier message: 19/09/2006, 12h32

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo