Hi all
i want to build my DB with JPA. I have an inner class which is extended from Hashmap but i don't know how to set the annotations correctly:
I have following example for my issue:
It's a 1:n relation
Table Car:
id|anyContent1|anycontent2
-----------------------------
1|Porsche | 911
2|OPEL | Astra
Tabelle CarItem
id|key |value |car_Id
-----------------------
1|color |green|1
2|seats| 4 |1
I tried to set the following annotations in my sample classes but it seems to be wrong:
Code:
@Entity
public class Car{
@Entity
public class CarItems extends HashMap<String, String>{
@OneToOne
Car carObj = new Car();
public Car getCar() {
return carObj;
}
public void setCar(Car carObj) {
this.carObj = carObj;
}
double priceOfAllItems;
.....
}
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private int carId;
public void setCarId(int carId) {
this.carId = carId;
}
public int getCarId() {
return carId;
}
@OneToOne(mappedBy="cdb")
private Car_Items carItems;
public CAData getCAR() {
return caData;
}
public String getResultID() {
return resultID;
}
}
How should i set the annotations to get above table structure. The structure of the classes i can't change. i've an inner class which is inherited from HashMap....
thanks in advance
Max[/QUOTE]