Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Hibernate tool generate JPA POJO?

May I know can the Eclipse plugin Hibernate tool use to generate JPA entity @entity? The Java files that generated look like below and not JPA:

package com.test.only.model;    

// Generated Jul 19, 2011 12:13:40 PM by Hibernate Tools 3.2.0.CR1

import java.math.BigDecimal;
import java.util.Date;

/**
 * Account generated by hbm2java
 */
public class Account implements java.io.Serializable {
like image 943
cometta Avatar asked Jul 19 '11 06:07

cometta


2 Answers

You just need to choose EJB3 + Java5 as configuration options when generating.
Learn more: http://docs.jboss.org/tools/4.0.0.Final/en/hibernatetools/html_single/index.html#jpa_annotations

like image 76
Max Rydahl Andersen Avatar answered Sep 22 '22 04:09

Max Rydahl Andersen


I believe you can generate Hibernate annotation code by using the Hibernate Perspective -> Add Configuration… and follow the steps of this tutorial .

I suspect the JPA annotated entity can be generated if you select JPA(jdk 1.5+) or Annotation (jdk 1.5+) in the following configuration .Please try it.

enter image description here

like image 27
Ken Chan Avatar answered Sep 23 '22 04:09

Ken Chan