1

I have the hibernate4-maven-plugin running but it isn't finding my annotated class and therfore generating an empty output file.

If I run the goal it tells me it is scanning the correct folder but it only finds two classes from a dependecy, not my annotated class.

[DEBUG] Detected classes with mapping-annotations:
[DEBUG]   org.springframework.data.jpa.domain.AbstractAuditable
[DEBUG]   org.springframework.data.jpa.domain.AbstractPersistable

My class:

package ch.tbz.schooltool.schooltoolbackend;

import ch.tbz.schooltool.schooltoolbackend.person.Gender;
import ch.tbz.schooltool.schooltoolbackend.person.Role;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.time.LocalDate;

@Entity
@Table(name = "PERSON")
@Data
@NoArgsConstructor
@EqualsAndHashCode(of = "id")
public class Person {

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "person_id_seq")
    @SequenceGenerator(name = "person_id_seq", sequenceName = "person_id_seq", allocationSize = 1)
    Integer id;

    String firstName;

    String lastName;

    @Enumerated(EnumType.STRING)
    Gender gender;

    LocalDate dateOfBirth;

    @Enumerated(EnumType.STRING)
    Role role;
}

My POM plugin:

            <plugin>
                <groupId>de.juplo</groupId>
                <artifactId>hibernate4-maven-plugin</artifactId>
                <version>1.0.5</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>export</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <hibernateProperties>${project.basedir}/schooltool-db/hibernate.hbm2ddl.properties
                    </hibernateProperties>
                    <outputFile>${project.basedir}/schooltool-db/create_ddl_generated.sql</outputFile>
                    <target>SCRIPT</target>
                    <type>CREATE</type>
                </configuration>
            </plugin>

My config:

hibernate.dialect=org.hibernate.dialect.PostgreSQL81Dialect
hibernate.connection.charSet=UTF-8
hibernate.export.schema.delimiter=;
hibernate.id.new_generator_mappings=true
hibernate.ejb.naming_strategy=org.hibernate.cfg.ImprovedNamingStrategy
2

1 Answer 1

1

As @Gerold Broser mentioned there are newer versions available. Using version 1.1.1 solved my problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.