Hi all. I'm new to hibernate, and have found a problem when mapping a map using annotations.
I've been using hbm files, but want to move to annotations.
Let me explain myself :
Entity PLAN <id name="plan_id"> <-- auto generated pk ... ... <map name="browsing_thresholds" table="DATAPLAN_BROWSING_THRESHOLDS" lazy="true" cascade="delete" > <key column="PLAN_ID" /> <map-key column="THRESHOLD" type="double" /> <element column="MESSAGE" type="string" length="160" /> </map>
This, maps to the following in MySql .. +-----------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+--------------+------+-----+---------+-------+ | PLAN_ID | bigint(20) | NO | PRI | NULL | | | MESSAGE | varchar(160) | YES | | NULL | | | THRESHOLD | double | NO | PRI | NULL | | +-----------+--------------+------+-----+---------+-------+
But i do not know how to use it in annotations. All i get is :
@OneToMany(mappedBy="dataplan") @MapKey(name="THRESHOLD") private Map <Double, String> vol_thresholds = new HashMap<Double,String>();
But do not know how to map the table name , or the MESSAGE column.
Please help me :)
|