Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
slam4:orm:hibernate:tools [2013/04/07 02:50] – [4- Génération des classes métiers] jcheron | slam4:orm:hibernate:tools [2019/08/31 14:21] (Version actuelle) – modification externe 127.0.0.1 | ||
---|---|---|---|
Ligne 40: | Ligne 40: | ||
* Cliquer sur le bouton Hibernate Run de la barre d' | * Cliquer sur le bouton Hibernate Run de la barre d' | ||
+ | * Choisir **Hibernate Code Generation configurations...** | ||
{{: | {{: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | * Cliquer sur le bouton **New** pour créer une nouvelle configuration | ||
+ | * Nommer la configuration, | ||
+ | |||
+ | {{: | ||
+ | |||
+ | * Activer l' | ||
+ | * Sélectionner la génération des annotations EJB3 | ||
+ | |||
+ | {{: | ||
+ | |||
+ | Vérifier la création des classes dans le package spécifié. | ||
+ | |||
+ | <sxh java; | ||
+ | |||
+ | // Generated 7 avr. 2013 01:39:14 by Hibernate Tools 3.4.0.CR1 | ||
+ | |||
+ | import javax.persistence.Column; | ||
+ | import javax.persistence.Entity; | ||
+ | import javax.persistence.GeneratedValue; | ||
+ | import static javax.persistence.GenerationType.IDENTITY; | ||
+ | import javax.persistence.Id; | ||
+ | import javax.persistence.Table; | ||
+ | |||
+ | /** | ||
+ | * Produit generated by hbm2java | ||
+ | */ | ||
+ | @Entity | ||
+ | @Table(name = " | ||
+ | public class Produit implements java.io.Serializable { | ||
+ | |||
+ | private Integer id; | ||
+ | private int idCategorie; | ||
+ | private String nom; | ||
+ | private float prix; | ||
+ | |||
+ | public Produit() { | ||
+ | } | ||
+ | |||
+ | public Produit(int idCategorie, | ||
+ | this.idCategorie = idCategorie; | ||
+ | this.nom = nom; | ||
+ | this.prix = prix; | ||
+ | } | ||
+ | |||
+ | @Id | ||
+ | @GeneratedValue(strategy = IDENTITY) | ||
+ | @Column(name = " | ||
+ | public Integer getId() { | ||
+ | return this.id; | ||
+ | } | ||
+ | |||
+ | public void setId(Integer id) { | ||
+ | this.id = id; | ||
+ | } | ||
+ | |||
+ | @Column(name = " | ||
+ | public int getIdCategorie() { | ||
+ | return this.idCategorie; | ||
+ | } | ||
+ | |||
+ | public void setIdCategorie(int idCategorie) { | ||
+ | this.idCategorie = idCategorie; | ||
+ | } | ||
+ | |||
+ | @Column(name = " | ||
+ | public String getNom() { | ||
+ | return this.nom; | ||
+ | } | ||
+ | |||
+ | public void setNom(String nom) { | ||
+ | this.nom = nom; | ||
+ | } | ||
+ | |||
+ | @Column(name = " | ||
+ | public float getPrix() { | ||
+ | return this.prix; | ||
+ | } | ||
+ | |||
+ | public void setPrix(float prix) { | ||
+ | this.prix = prix; | ||
+ | } | ||
+ | |||
+ | } | ||
+ | </ |