Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate: How can I force hibernate to set types for collections?

I'm quite lost with a hibernate problem and hope that you can help me =)!

Here's my problem:

I have a Database with two tables, Addressbook and Contact, The relation between those is, in my scenarion, 1:n.

Now Hibernate generates me the following Code, after reverse engineering, in the Class "AbstractAddressbook":

private Set contacts = new HashSet(0);

But what i would need instead would be this:

private Set<Contact> contacts = new HashSet<Contact>(0);

How can I accomplish this, where do I have to set it up for the reverse engineering?

like image 852
James Carter Avatar asked Jan 14 '23 05:01

James Carter


1 Answers

On Exporters in "Hibernate Code Generation Configurations" select "Use Java 5 syntax"

like image 104
Miguel Gomes Avatar answered Jan 17 '23 03:01

Miguel Gomes