Comic Sans MS Lover Comic Sans MS Lover -5 years ago 158
Java Question

Hibernate - How to provide right mapping to integer type?

I'm executing my maven build and it throws this exception:

Last cause: Wrong column type in x.clients for column type. Found: tinyint, expected: integer

I'm mapping like this:

@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;

And I'm creating the column using InnoDB like this:

Shouldn't this be ok? Why is it saying that he is finding tinyint?

Answer Source

Use @Basic for basic integers. You can always trying declaring your ID as a Long though. I usually always use Long for my IDs. See Mapping Identifier Properities:

@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download