I am new to hibernate.
I am using hibernate-core and hibernate-annotation – 3.5.1.
I have a java class – event – that has an ‘id’ – within a Spring MVC application that is stored in the database using Hibernate.
Code:
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Integer id;
This generated ‘id’ is passed back to originating user in an HTTP response.
I would therefore like to use a map of ‘events’ with a key of ‘id’ so that on ‘deletion’/’change’ based on ‘id’ no search is necessary.
I have looked at many of the Hibernate / java.util.map websites but I am not sure if it is possible to auto generate the ‘key’ to a map and if so how the annotation / ‘code to put entries into the map’ would work.
Thanks for any help.