Hallo, ich hab folgendes Problem:
Ich hab zwei Entity Klassen die heißen: Person, Journey
Die Klasse Journey roll einen driver (also eine Person enthalten)
Wenn ich jedoch eine Journey in meine Datenbank speichern will bekomm ich immer die Meldung dass der Wert
von driver ungültig ist. Ich weiß wirklich nicht wieso???
Hier sind mal meine Entities:
Person:
und Journey:
hier ist mein JSF File wo ich meine Journey eintrage:
Ich bekomm immer den Fehler:
j_idt41:j_idt49:driver: Überprüfungsfehler: Wert ist ungültig.
Ich weiß nicht was falsch ist???
Ich würd mich sehr über jeden Kommentar und jede Hilfe freuen
lg.
Ich hab zwei Entity Klassen die heißen: Person, Journey
Die Klasse Journey roll einen driver (also eine Person enthalten)
Wenn ich jedoch eine Journey in meine Datenbank speichern will bekomm ich immer die Meldung dass der Wert
von driver ungültig ist. Ich weiß wirklich nicht wieso???
Hier sind mal meine Entities:
Person:
Code:
@Entity public class Person implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @NotBlank @Column(nullable = false) private String firstname; @NotBlank @Column(nullable = false) private String lastname; @NotBlank @Column(nullable = false, unique = true) @Email private String email; @NotBlank @Size(min = 8) @Column(nullable = false) private String password; @OneToMany private List<Journey> journeys = new ArrayList<Journey>(); //Getter & Setter...
und Journey:
Code:
@Entity public class Journey implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Column(nullable = false) @NotBlank private String departure; @Column(nullable = false) @NotBlank private String destination; @Column(nullable = false) @NotNull @Temporal(javax.persistence.TemporalType.DATE) @Future private Date departureDate; @Column(nullable = false) @NotNull @Temporal(javax.persistence.TemporalType.TIMESTAMP) private Date departureTime; @Column(nullable = false) @NotBlank private String estimatedDuration; @Column(nullable = false) @NotBlank @Size(min=4) @Pattern(regexp="\\d{4,5}") private String departureZip; @Column(nullable = false) @NotBlank @Size(min=4) @Pattern(regexp="\\d{4,5}") private String destinationZip; @ManyToOne private Person driver; //Getter & Setter ...
hier ist mein JSF File wo ich meine Journey eintrage:
Code:
<h:panelGrid columns="2" cellpadding="10"> <h:outputLabel value="#{bundle.CreateJourneyLabel_driver}" for="driver" /> <h:selectOneMenu id="driver" value="#{journeyController.selected.driver}" title="#{bundle.CreateJourneyTitle_driver}" > <f:selectItems value="#{personController.itemsAvailableSelectOne}"/> </h:selectOneMenu> <h:outputLabel value="#{bundle.CreateJourneyLabel_estimatedDuration}" for="estimatedDuration" /> <h:inputText id="estimatedDuration" value="#{journeyController.selected.estimatedDuration}" required="true" /> <h:outputLabel value="#{bundle.CreateJourneyLabel_departureDate}" for="departureDate" /> <h:inputText id="departureDate" value="#{journeyController.selected.departureDate}" required="true" > <f:convertDateTime type="date" pattern="dd.MM.yyyy" /> </h:inputText> <h:outputLabel value="#{bundle.CreateJourneyLabel_departure}" for="departure" /> <h:inputText id="departure" value="#{journeyController.selected.departure}" required="true" /> <h:outputLabel value="#{bundle.CreateJourneyLabel_departureTime}" for="departureTime" /> <h:inputText id="departureTime" value="#{journeyController.selected.departureTime}" required="true" > <f:convertDateTime type="time" pattern="HH:mm" /> </h:inputText> <h:outputLabel value="#{bundle.CreateJourneyLabel_departureZip}" for="departureZip" /> <h:inputText id="departureZip" value="#{journeyController.selected.departureZip}" required="true" /> <h:outputLabel value="#destination" for="destination" /> <h:inputText id="destination" value="#{journeyController.selected.destination}"required="true"/> <h:outputLabel value="destination ZIP" for="destinationZip" /> <h:inputText id="destinationZip" value="#{journeyController.selected.destinationZip}" required="true"/> </h:panelGrid> <h:commandLink action="#{journeyController.create}" value="#{bundle.CreateJourneySaveLink}" />
j_idt41:j_idt49:driver: Überprüfungsfehler: Wert ist ungültig.
Ich weiß nicht was falsch ist???
Ich würd mich sehr über jeden Kommentar und jede Hilfe freuen
lg.
Comment