Code:
@Entity
@Table(name = "BES", catalog = "...", schema = "dbo")
public class JobEndPoint implements Serializable {
private static final long serialVersionUID = 1017986852824783744L;
@Id
protected JobEndPointPK jobEndPointPK;
@Column(name = "`Stoppzeit`")
int stopTime;
@Column(name = "`WA-Zeit von`")
@Temporal(TemporalType.TIME)
Date acceptanceTimeFrom;
@Column(name = "`WA-Zeit bis`")
@Temporal(TemporalType.TIME)
Date acceptanceTimeTo;
@Column(name = "`WA-Zeit2 von`")
@Temporal(TemporalType.TIME)
Date acceptanceTime2From;
@Column(name = "`WA-Zeit2 bis`")
@Temporal(TemporalType.TIME)
Date acceptanceTime2To;
@Column(name = "`Kdspez Puffer1 (0:00 Uhr bis 06:30 Uhr)`")
int buffer1;
@Column(name = "`Kdspez Puffer2 (6:30 Uhr bis 13:00 Uhr)`")
int buffer2;
@Column(name = "`Kdspez Puffer3 (13:00 Uhr bis 24:00 Uhr)`")
int buffer3;
//...
}
@Embeddable
public class JobEndPointPK implements Serializable {
@Basic(optional = false)
@Column(name = "`Ladetyp`", nullable = false, length = 50)
@Enumerated
EndPointType type;
@Basic(optional = false)
@Column(name = "`KundenNr`", nullable = false)
int customerId;
@Basic(optional = false)
@Column(name = "`VerkArt`", nullable = false, length = 10)
@Enumerated
JobType jobType;
@Basic(optional = false)
@Column(name = "`LKZ`", nullable = false, length = 3)
String countryCode;
@Basic(optional = false)
@Column(name = "`PLZ`", nullable = false, length = 7)
String zipCode;
//...
}
@Entity
@Table(name = "Auftragsdaten", catalog = "...", schema = "dbo")
public class Job implements Comparable<Object>, Serializable {
private static final long serialVersionUID = 4285871251915951149L;
@Id
@Basic(optional = false)
@Column(name = "`id`", nullable = false)
int id;
@Column(name = "`AufNr`", nullable=false)
int jobId;
@Transient
List<Integer> jobsAdded;
@Column(name = "`Beladedatum`", nullable=false)
@Temporal(TemporalType.DATE)
Date loadDate;
@Column(name = "`Beladezeit`")
@Temporal(TemporalType.TIME)
Date loadTimeFrom;
@Transient
Date loadTimeTo;
@Column(name = "`Entladedatum`", nullable=false)
@Temporal(TemporalType.DATE)
Date unloadDate;
@Column(name = "`Entladezeit Beginn`")
@Temporal(TemporalType.TIME)
Date unloadTimeFrom;
@Column(name = "`Entladezeit Ende`")
@Temporal(TemporalType.TIME)
Date unloadTimeTo;
@Transient
List<JobEndPoint> froms;
@ManyToOne
@JoinColumns ({
@JoinColumn(name="`AbsNr`", referencedColumnName = "`KundenNr`", insertable = false, updatable = false),
@JoinColumn(name="`Verkehrsart`", referencedColumnName = "`VerkArt`", insertable = false, updatable = false),
@JoinColumn(name="`von LKZ`", referencedColumnName = "`LKZ`", insertable = false, updatable = false),
@JoinColumn(name="`von PLZ`", referencedColumnName = "`PLZ`", insertable = false, updatable = false),
@JoinColumn(name="`Beladetyp`", referencedColumnName = "`Ladetyp`", insertable = false, updatable = false)
})
JobEndPoint fromPoint;
@Transient
JobEndPoint toPoint;
@Column(name = "`Verkehrsart`", length = 10, nullable=false)
@Enumerated
JobType type;
@Column(name = "`Anzahl Paletten CCG1`")
int numberCCG1;
@Column(name = "`Anzahl Paletten CCG2`")
int numberCCG2;
@Transient
int numberFullContainer;
@Transient
int numberEmptyContainer;
@Column(name = "`Anzahl Container`")
int numberContainer;
@Column(name = "`Anz Stellplätze`")
int numberUnits;
@Column(name = "`Bruttogewicht`", nullable=false)
int loadWeight;
@ManyToOne
@JoinColumn(name="`Kühlkennzeichen`")
CoolingCode coolingCode;
@Transient
boolean obligation;
@Transient
float distance;
@Transient
double loadFactor;
//...
}
Danke noch mal. Was genau mache ich falsch?
Hier ist die Exception:
Code:
Exception in thread "main" javax.persistence.PersistenceException: [PersistenceUnit: TouroptimizerFrameworkPU] Unable to configure EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:265)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:125)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
at JobJpaController.<init>(JobJpaController.java:24)
at Tester.main(Tester.java:6)
Caused by: org.hibernate.AnnotationException: Column name LKZ of JobEndPoint not found in JoinColumns.referencedColumnName
at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:319)
at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:89)
at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:499)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:304)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1225)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:159)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:854)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:191)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:253)
... 5 more
Java Result: 1