Hibernate Tools - is it possible ignore composite-id in table?

I have this table with composite primary key:

CREATE TABLE `arc_test` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `data` datetime DEFAULT NULL,
  `text` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`,`data`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

and this hibernate reverse engineering configuration:

<hibernate-reverse-engineering>  
    <table name="arc_test" catalog="db">
        <primary-key>
            <generator class="native"/>
        </primary-key>       
    </table> 
</hibernate-reverse-engineering> 

Hibernate Tools generated this two class:

public class ArcTest implements java.io.Serializable
{
    private ArcTestId   id;
    private String      text;
    .....
    .....

public class ArcTestId implements java.io.Serializable
{
    private Integer id;
    private Date    data;
        .....
        .....

but I would like only one class like this:

   public class ArcTest implements java.io.Serializable
    {
        private Integer id;
        private Date    data;
        private String  text;
        .....
        .....

is it possible with Hibernate Tools generator?

It doesn’t seem to me that this is currently possible. You can create a feature request for this on the JIRA issue tracker though: Hibernate Tools - Issues - Hibernate JIRA

1 Like