# Hibernate-tools-maven-plugin does not strongly type foreign sets

**URL:** <https://discourse.hibernate.org/t/hibernate-tools-maven-plugin-does-not-strongly-type-foreign-sets/6176>\
**Category:** Hibernate Tools\
**Created:** [March 28, 2022, 7:25am UTC](https://discourse.hibernate.org/t/hibernate-tools-maven-plugin-does-not-strongly-type-foreign-sets/6176 "2022-03-28T07:25:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![martinfr87](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@martinfr87](https://discourse.hibernate.org/u/martinfr87)\
**Post date:** [March 28, 2022, 7:25am UTC](https://discourse.hibernate.org/t/hibernate-tools-maven-plugin-does-not-strongly-type-foreign-sets/6176/1 "2022-03-28T07:25:48Z")

</div>

Foreign key-derived sets are not strongly typed as they should when generating entity classes with the Maven plugin.

I have noticed a difference between the files generated

- with hibernate-tools-maven-plugin
- with, eg., the JPA Tools of Eclipse.

Say we have the Northwind database, a Customers entity is generated:

```auto
@Entity
@Table(name="customers"
    ,schema="NORTHWIND"
    ,catalog="NORTHWIND"
)
public class Customers implements java.io.Serializable {

     private Integer id;
     // [...]
     private Set<Orders> orderses = new HashSet<Orders>(0);

```

Notice the orderses member. It is not strongly-typed, as it should, when entity generation is done through hibernate-tools-maven-plugin.

It is strongly typed when entity generation is performed with JPA Tools:

`private Set<Orders> orderses = new HashSet<Orders>(0);`

Will this be fixed in the 6.0.0 release?  
BTW how to try the 6.0.0 release of the Maven plugin?

---

<div class="post-metadata">

**Author:** ![martinfr87](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@martinfr87](https://discourse.hibernate.org/u/martinfr87)\
**Post date:** [April 3, 2022, 5:52pm UTC](https://discourse.hibernate.org/t/hibernate-tools-maven-plugin-does-not-strongly-type-foreign-sets/6176/2 "2022-04-03T17:52:39Z")

</div>

Sorry, the hibernate-tools-maven-plugin generates the following code:

`private Set orderses = new HashSet(0);`

which is not strongly typed.

---

<div class="post-metadata">

**Author:** ![johnrline](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/johnrline/32/2894_2.png) [@johnrline](https://discourse.hibernate.org/u/johnrline)\
**Post date:** [December 28, 2023, 7:00pm UTC](https://discourse.hibernate.org/t/hibernate-tools-maven-plugin-does-not-strongly-type-foreign-sets/6176/3 "2023-12-28T19:00:24Z")

</div>

`<jdk5>true</jdk5>` you need to add this setting to the configuration
