Bonjour tout le monde ,je dispose d'une table dans ma BD oracle ,a laquelle je voudrais accéder pour cela j'ai généré mon entité depuis la table
voici mon 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
 
import java.io.Serializable;
import javax.persistence.*;
 
import java.math.BigDecimal;
 
 
/**
 * The persistent class for the BILAN database table.
 * 
 */
@Entity
 
@NamedQueries( {
	@NamedQuery(name = "bilan.findAll", query = "from Bilan") })
public class Bilan implements Serializable {
	private static final long serialVersionUID = 1L;
 
	@EmbeddedId
	private BilanPK id;
 
	@Column(name="DATE_MAJ")
	private BigDecimal dateMaj;
 
	@Column(name="DATE_PURGE")
	private BigDecimal datePurge;
 
	private BigDecimal entete;
 
	private String info;
 
    public Bilan() {
    }
 
	public BilanPK getId() {
		return this.id;
	}
 
	public void setId(BilanPK id) {
		this.id = id;
	}
 
	public BigDecimal getDateMaj() {
		return this.dateMaj;
	}
 
	public void setDateMaj(BigDecimal dateMaj) {
		this.dateMaj = dateMaj;
	}
 
	public BigDecimal getDatePurge() {
		return this.datePurge;
	}
 
	public void setDatePurge(BigDecimal datePurge) {
		this.datePurge = datePurge;
	}
 
	public BigDecimal getEntete() {
		return this.entete;
	}
 
	public void setEntete(BigDecimal entete) {
		this.entete = entete;
	}
 
	public String getInfo() {
		return this.info;
	}
 
	public void setInfo(String info) {
		this.info = info;
	}
 
}
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
 
import java.io.Serializable;
import javax.persistence.*;
 
/**
 * The primary key class for the BILAN database table.
 * 
 */
@Embeddable
public class BilanPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;
 
	@Column(name="TYPE_BILAN")
	private long typeBilan;
 
	@Column(name="DATE_BILAN")
	private long dateBilan;
 
	@Column(name="TYPE_TABLE")
	private long typeTable;
 
	@Column(name="ID_EEC")
	private long idEec;
 
    public BilanPK() {
    }
	public long getTypeBilan() {
		return this.typeBilan;
	}
	public void setTypeBilan(long typeBilan) {
		this.typeBilan = typeBilan;
	}
	public long getDateBilan() {
		return this.dateBilan;
	}
	public void setDateBilan(long dateBilan) {
		this.dateBilan = dateBilan;
	}
	public long getTypeTable() {
		return this.typeTable;
	}
	public void setTypeTable(long typeTable) {
		this.typeTable = typeTable;
	}
	public long getIdEec() {
		return this.idEec;
	}
	public void setIdEec(long idEec) {
		this.idEec = idEec;
	}
 
	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof BilanPK)) {
			return false;
		}
		BilanPK castOther = (BilanPK)other;
		return 
			(this.typeBilan == castOther.typeBilan)
			&& (this.dateBilan == castOther.dateBilan)
			&& (this.typeTable == castOther.typeTable)
			&& (this.idEec == castOther.idEec);
 
    }
 
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + ((int) (this.typeBilan ^ (this.typeBilan >>> 32)));
		hash = hash * prime + ((int) (this.dateBilan ^ (this.dateBilan >>> 32)));
		hash = hash * prime + ((int) (this.typeTable ^ (this.typeTable >>> 32)));
		hash = hash * prime + ((int) (this.idEec ^ (this.idEec >>> 32)));
 
		return hash;
    }
}
ma class main :
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
 
 
import java.util.Iterator;
import java.util.List;
 
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;
 
import org.apache.log4j.Logger;
 
public class BilanService {
 
    // private static final String PERSISTENCE_UNIT = "supe";
 
	private static Logger logger = Logger.getLogger(BilanService.class);
 
	public static void main(String[] args) {
		// TODO Auto-generated method stub
 
 
 
 
 
 
 
 
		logger.debug("** getBilan called...");
 
		EntityManagerFactory entityManagerFactory = Persistence
				.createEntityManagerFactory("testJPA");
 
		EntityManager em = entityManagerFactory.createEntityManager();
 
		Query findAllQuery = em.createNamedQuery("bilan.findAll");
 
		List<Bilan> bilan = findAllQuery.getResultList();
 
		Iterator stIterator=bilan.iterator();
		while(stIterator.hasNext()){
		Bilan st=(Bilan)stIterator.next();
		System.out.print("id:"+st.getId());
		System.out.print(" date maj:"+st.getDateMaj());
		System.out.print(" date purge:"+st.getDatePurge());
 
		System.out.println();
 
		}
 
 
 
 
		if (bilan != null)
			logger.debug("** Found " + bilan.size() + " records:");
 
 
	}
 
 
 
}
mon fichier persistence.xml
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
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
	<persistence-unit name="testJPA">
		<provider>org.hibernate.ejb.HibernatePersistence</provider>
 
 
	<class>Bilan</class>
		<class>BilanPK</class>
 
 
	<properties>
			<property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver" />
			<property name="hibernate.connection.url" value="dbc:oracle:thin:@192.160.123.22:1521:supe" />
			<property name="hibernate.connection.username" value="db_supe" />
			<property name="hibernate.connection.password" value="plasupe" />
			<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect" />
 
 
			<property name="hibernate.show_sql" value="true" />
			<property name="hibernate.use_sql_comments" value="false" />
 
		</properties>
 
 
 
 
	</persistence-unit>
</persistence>
quand j'execute mon main ,j'obtiens l'erreur suivante :
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
log4j:WARN No appenders could be found for logger (BilanService).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" java.lang.SecurityException: class "javax.persistence.PersistenceContextType"'s signer information does not match signer information of other classes in the same package
	at java.lang.ClassLoader.checkCerts(Unknown Source)
	at java.lang.ClassLoader.preDefineClass(Unknown Source)
	at java.lang.ClassLoader.defineClass(Unknown Source)
	at java.security.SecureClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.access$000(Unknown Source)
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
	at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:39)
	at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:34)
	at BilanService.main(BilanService.java:34)
j'arrive pas a comprendre ce probleme !!
merci d'avance pour votre aide