Guest User

Untitled

a guest
Jan 14th, 2018
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 2.46 KB | None | 0 0
  1. //Fiches models
  2. package models;
  3.  
  4. import java.util.*;
  5. import javax.persistence.*;
  6.  
  7. import play.db.jpa.*;
  8.  
  9. @Entity
  10. public class Fiches extends Model {
  11.  
  12.     public String _nomLatin;
  13.     public String _nomCommun;
  14.     @Lob
  15.     public String _dimorphismeSexuel;
  16.     @Lob
  17.     public String _taille;
  18.     @Lob
  19.     public String _informationsGenerales;
  20.     @Lob
  21.     public String _habitatNaturel;
  22.     @Lob
  23.     public String _alimentation;
  24.     @Lob
  25.     public String _enCaptivite;
  26.     @Lob
  27.     public String _reproduction;
  28.     @Lob
  29.     public String _photo;
  30.    
  31.     @ManyToOne
  32.     public Categorie _categorie;
  33.     @ManyToOne
  34.     public SousCategorie _sousCategorie;
  35.    
  36.     public Fiches(Categorie cat, SousCategorie sousCat, String nomLatin, String nomCommun, String dimoSex, String taille, String infoGen, String habitatNat, String alim, String captivite, String repro, String photo) {
  37.         this._categorie = cat;
  38.         this._sousCategorie = sousCat;
  39.         this._nomLatin = nomLatin;
  40.         this._nomCommun = nomCommun;
  41.         this._dimorphismeSexuel = dimoSex;
  42.         this._taille = taille;
  43.         this._informationsGenerales = infoGen;
  44.         this._habitatNaturel = habitatNat;
  45.         this._alimentation = alim;
  46.         this.enCaptivite = captivite;
  47.         this._reproduction = repro;
  48.         this._photo = photo;
  49.     }
  50.  
  51. }
  52.  
  53. //Categorie models
  54. package models;
  55.  
  56. import java.util.*;
  57. import javax.persistence.*;
  58.  
  59. import play.db.jpa.*;
  60.  
  61. @Entity
  62. public class Categorie extends Model {
  63.  
  64.     public String _nom;
  65.    
  66.     public Categorie(String nom) {
  67.         this._nom = nom;
  68.     }
  69.  
  70. }
  71.  
  72. //SubCategory models
  73. package models;
  74.  
  75. import java.util.*;
  76. import javax.persistence.*;
  77.  
  78. import play.db.jpa.*;
  79.  
  80. @Entity
  81. public class SousCategorie extends Model {
  82.  
  83.     public String _nom;
  84.     @ManyToOne
  85.     public Categorie _categorie;
  86.    
  87.     public SousCategorie(String nom, String categorie) {
  88.         this._nom = nom;
  89.         this._categorie = categorie;
  90.     }
  91.  
  92. }
  93.  
  94. //Fiches controller
  95. package controllers;
  96.  
  97. import java.util.*;
  98.  
  99. import play.*;
  100. import play.mvc.*;
  101.  
  102. import models.*;
  103.  
  104. public class Fiches extends Controller {
  105.  
  106.     public static void index() {
  107.         List<Categorie> _cat = Categorie.find("order by nom ASC").fetch();
  108.         render(_cat);
  109.     }
  110.  
  111. }
  112.  
  113. //Errors
  114. The file /app/models/Fiches.java could not be compiled. Error raised is : enCaptivite cannot be resolved or is not a field
Add Comment
Please, Sign In to add comment