Questions tagged [hbm2java]

Use this tag when using hbm2java for Hibernate Class Generation

Hibernate is a popular open source library for handling object/relational persistence and queries. In Hibernate, mapping between database tables and POJO ("plain old Java objects") classes is configured in a set of XML mapping files. hbm2java is a code generator that converts the mapping files into POJOs. It is part of the Hibernate Tools subproject and can be downloaded in the separate Hibernate Extensions package.

Hibernate Class Generation Using hbm2java - O'Reilly Media

32 questions
7
votes
3 answers

Maven Java Source Code Generation for Hibernate

I´m busy converting an existing project from an Ant build to one using Maven. Part of this build includes using the hibernate hbm2java tool to convert a collection of .hbm.xml files into Java. Here's a snippet of the Ant script used to do…
Adam
  • 682
  • 1
  • 6
  • 27
5
votes
2 answers

How to configure hbm2java and hbm2dao to add packagename to generated classes

I'm trying to configure hbm2java with maven to generate POJO classes and DAO objects. One of the issues I'm dealing with is package names aren't generated. I'm using the following pom for that: hbm2java
mmm
  • 1,277
  • 5
  • 18
  • 34
5
votes
1 answer

How to generate comments in hbm2java created POJO?

My current setup using hibernate uses the hibernate.reveng.xml file to generate the various hbm.xml files. Which are then turned into POJOs using hbm2java. We spent some time while designing our schema, to place some pretty decent descriptions on…
Jacob Schoen
  • 14,034
  • 15
  • 82
  • 102
5
votes
0 answers

Hibernate error: mixing nullable and non nullable properties on hbm2java code

I'm using the hibernate3-maven-plugin to query an Oracle10g database and generate java classes with JPA annotations, using the hbm2java goal. Then I use spring to configure a session factory that scans the annotated code. After a long struggle with…
3
votes
5 answers

hibernate hbm2hbmxml

I am trying to use ant hibernatetool task to generate hbm.xml files from my db schema in mysql. ant task runs without errors but no hbm.xml files are generated. What am I missing... Here are the relevant coonfigurations: build.xml
ashweta
  • 1,437
  • 3
  • 17
  • 19
3
votes
1 answer

How do I configure the hbm2java maven2 plugin to generate POJOs for all mapping files

I am trying to migrate my ant build to maven2. in my build.xml I invoke the hbm2java in the following way:
naor
  • 31
  • 1
  • 2
3
votes
4 answers

How to add hbm2java task to Ant in NetBeans

I'm trying to generate POJO's from mapping xml files. I read something about adding an ant task, to do it easily. I've added this xml below to my project's build-impl.xml in Netbeans, but nothing happens:
Janov Byrnisson
  • 255
  • 1
  • 3
  • 9
3
votes
1 answer

Getting SEVERE: Could not locate SessionFactory in JNDI while getting sessionfactory

I am using hibernate as persistence layer to communicate with the database. I used maven plugin hbm2java to generate dao, java, *hbm.xml and hibernate.cfg.xml. till that time plugins works fine. But when I trying to communicate to db it gives…
Prasad S Deshpande
  • 1,362
  • 4
  • 15
  • 35
3
votes
2 answers

Missing dependancy information for jdbc.artifact.groupid:jdbc-driver:jar:1.0

I am trying to use hbm2java maven plugins for hibernate. For mvn hibernate3:hbm2cfgxml goal I am facing following error. [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO]…
Prasad S Deshpande
  • 1,362
  • 4
  • 15
  • 35
2
votes
2 answers

What are best practices for using Hibernate's hbm2java?

I am using Hibernate, Maven, and Eclipse (STS build) to build a project. I'm using hbm.xml files to specify my schema. I want to use Hibernate's hbm2java to generate my model classes. I have it working well and generating the kind of code I…
Marvo
  • 17,845
  • 8
  • 50
  • 74
2
votes
1 answer

Class inheritance with Hibernate and hbm2java

I am generating my domain objects from my hbm files with hbm2java and now I want them to all inherit a base class. This class will have some utility methods for dealing with listeners. It does not really need to be persisted and I am hoping that I…
willcodejavaforfood
  • 43,223
  • 17
  • 81
  • 111
2
votes
1 answer

What's the easiest way to amend the file name of pojos during hbm2java generation

I'm using hbm2java via maven to generate pojos, it will produce files such as Table.java, but what I want is AbstractTable.java Is there an easy way to do this? From my pom.xml: …
1
vote
2 answers

Ensure that hbm2java creates Entity classes that use jakarta.persistence rather than javax.persistence?

When I run hbm2java I would like it to create Entity classes that: import jakarta.persistence rather than (as currently) import javax.persistence I am invoking hbm2java from a Maven build thus: org.hibernate
Lawrence Tierney
  • 856
  • 1
  • 12
  • 30
1
vote
2 answers

hbm2java failed:Unable to load class declared as

I am implementing generation of the domain/model POJOs from database using the Hibernate3 Maven Plugin. The rationale is to ensure a DBA's updates to the database are automatically mapped to the model layer before a developer starts working on…
Anadi Misra
  • 1,925
  • 4
  • 39
  • 68
1
vote
2 answers

Hibernate reverse engineering primary keys (EmbeddedId to IdClass)

I am using hbm2java (hibernate3-maven-plugin) in order to generate entities. How do I switch the auto generated @EmbeddedId to @IdClass? Thanks
1
2 3