We have difficulty saving data in our Google App Engine project, we have the classes "Client", "Booking" and "Room".
Our goal is to correlate the relationship between them, with a one-to-many relationship from customer to reservation and a one-to-many relationship from room to same reservation.
The exception is:
Error in metadata for no.hib.mod250.asm2.model.Reservation.id: cannot have the primary key java.lang.Long and be a child (the owner field is no.hib.mod250.asm2. Model.Customer.res) .
Our code is as follows:
Customer.java
@PersistenceCapable(identityType=IdentityType.APPLICATION) public class Customer implements Serializable { @PrimaryKey @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY) private Long id; (...)
Room.java
@PersistenceCapable(identityType=IdentityType.APPLICATION) public class Room implements Serializable { @PrimaryKey @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY) private Long id; (...)
Reservation.java
@PersistenceCapable(identityType=IdentityType.APPLICATION) public class Reservation implements Serializable { @PrimaryKey @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY) private Long id; (...) @Persistent private Room room; @Persistent private Customer customer; (...) }
user212860
source share