Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.planetjpa;
- import java.io.Serializable;
- import javax.persistence.*;
- import java.util.Date;
- @Entity
- public class Reservationscene implements Serializable {
- private static final long serialVersionUID = 1L;
- @Id
- @Column(name="id_res_scene")
- private Integer idResScene;
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name="date_reserv_scene")
- private Date dateReservScene;
- @ManyToOne
- @JoinColumn(name="scene_id")
- private Scences scene_reserve;
- @ManyToOne
- @JoinColumn(name="user_c_id")
- private User user_courant;
- public Scences getScene_reserve() {
- return scene_reserve;
- }
- public void setScene_reserve(Scences scene_reserve) {
- this.scene_reserve = scene_reserve;
- }
- public User getUser_courant() {
- return user_courant;
- }
- public void setUser_courant(User user_courant) {
- this.user_courant = user_courant;
- }
- public Reservationscene() {
- }
- public int getIdResScene() {
- return this.idResScene;
- }
- public void setIdResScene(int idResScene) {
- this.idResScene = idResScene;
- }
- public Date getDateReservScene() {
- return this.dateReservScene;
- }
- public void setDateReservScene(Date dateReservScene) {
- this.dateReservScene = dateReservScene;
- }
- }
- <?xml version="1.0" encoding="UTF-8"?>
- <persistence version="2.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_2_0.xsd">
- <persistence-unit name="projetjsf">
- <class>org.planetjpa.Films</class>
- <class>org.planetjpa.Lieux</class>
- <class>org.planetjpa.Reservationscene</class>
- <class>org.planetjpa.Scences</class>
- <class>org.planetjpa.User</class>
- <properties>
- <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/projetjsf"/>
- <property name="javax.persistence.jdbc.user" value="root"/>
- <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
- <property name="javax.persistence.jdbc.password" value="amine1993"/>
- <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
- <property name="hibernate.show_sql" value="true" />
- <property name="hibernate.hbm2ddl.auto" value="create-drop" />
- <property name="hibernate.format_sql" value="true"/>
- <property name="hibernate.hbm2ddl.auto" value="update"/>
- <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
- </properties>
- </persistence-unit>
- </persistence>
- Exception in thread "main" javax.persistence.PersistenceException: [PersistenceUnit: projetjsf] Unable to build EntityManagerFactory
- at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
- at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)
- at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56)
- at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
- at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.buildEntityManagerFactory(Main.java:94)
- at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:80)
- at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:68)
- Caused by: org.hibernate.AnnotationException: Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements: org.planetjpa.Scences.liste_reserv_scenes
- at org.hibernate.cfg.annotations.CollectionBinder.getCollectionBinder(CollectionBinder.java:321)
- at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1693)
- at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:765)
- at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:684)
- at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3406)
- at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3360)
- at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1334)
- at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1724)
- at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)
- at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
- ... 6 more
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement