3 Replies Latest reply on Oct 15, 2010 3:38 AM by csenes csenes

    create table issue

    csenes csenes Newbie

      hi,


      I tried to setup my seam application for another server.as connection pools pings succesfully,I mean there is databaseconnection,but when I deploy enterprise app,some tables created ,some tables not, actually a few created lots of table not, I put code here created one and not created one and persistence.xml ,I waited a solution,what I have to do , why it does happen?


      I am using Sun GlassFish Enterprise Server v2.1 (9.1.1) (build b60e-fcs)



            


      It is created one




      @Entity
      @Name("egitim")
      @Table(name = "EYS_EGITIM")
      public class Egitim implements java.io.Serializable {
      
           /**
            * 
            */
           private static final long serialVersionUID = 1L;
      
           @Id
           @GeneratedValue(strategy = GenerationType.AUTO)
           @Column(name = "T_ID")
           @NotNull
           private Long id;
      
           @ManyToOne(fetch = FetchType.LAZY)
           @JoinColumn(name = "T_ISTEK_YAPAN_KULLANICI")
           private Users istekYapanKullanici;
           @ManyToOne(fetch = FetchType.LAZY)
           @JoinColumn(name = "T_EGITIM_VEREN_KISI")
           private Users egitimVerecekKisi;
      
           @Column(name = "T_TANIM", length = 255)
           @Length(max = 255)
           private String tanim;
           
           @Column(name = "T_EGITIM_TIPI")
           private EgitimTipi egitimTipi;
           @Column(name = "T_EGITIM_ZAMAN_ISTEGI")
           @Temporal(TemporalType.TIMESTAMP)
           private Date egitimZamanIstegi;
           @Column(name = "T_EGITIM_ZAMANI")
           @Temporal(TemporalType.TIMESTAMP)
           private Date egitimZamani;
           @Column(name = "T_AD", length = 60)
           @Length(max = 60)
           private String ad;
           @Column(name = "T_PLANLI")
           private Boolean planli;
      
           @Column(name = "T_ANKET_YAPILACAKMI")
           private Boolean anketYapilacakmi=false;
           @Column(name = "T_HARCAMA_GEREKIYOR")
           private Boolean harcamaGerekli;
      
           @Column(name = "T_EGITIM_VERECEK_KURUM")
           private String egitimVerecekKurum;
      
           @ManyToOne(fetch = FetchType.LAZY)
           @JoinColumn(name = "T_EGITIM_DURUM_BILGISI")
           private EgitimDurumBilgisi egitimDurumBilgisi;
           
           @ManyToOne(fetch = FetchType.LAZY)
           @JoinColumn(name = "T_EGITIM_YERI")
           private EgitimYeri egitimYeri;
           
           @ManyToOne(fetch = FetchType.LAZY)
           @JoinColumn(name = "T_EGITIM_DOSYA")
           private EgitimDosya egitimDosya;
           
           @ManyToOne(fetch = FetchType.LAZY)
           @JoinColumn(name = "T_ANKET_ISLEMI")
           private AnketIslemi anketIslemi;
           
           @Column(name = "T_EGITIM_RAPORU")
           @Lob
           private String egitimRaporu;
           
           @ManyToMany(fetch = FetchType.LAZY)
           @JoinTable(name = "EYS_EGITIM_TO_KATILIMCI", joinColumns = { @JoinColumn(name = "T_EGITIM_ID") }, inverseJoinColumns = { @JoinColumn(name = "T_KATILIMCI_ID") })
           private List<Users> egitimKatilimcilari = new ArrayList<Users>(0);
      
           public Long getId() {
                return id;
           }
      
           public void setId(Long id) {
                this.id = id;
           }
      
           public Users getIstekYapanKullanici() {
                return istekYapanKullanici;
           }
      
           public void setIstekYapanKullanici(Users istekYapanKullanici) {
                this.istekYapanKullanici = istekYapanKullanici;
           }
      
           public Users getEgitimVerecekKisi() {
                return egitimVerecekKisi;
           }
      
           public void setEgitimVerecekKisi(Users egitimVerecekKisi) {
                this.egitimVerecekKisi = egitimVerecekKisi;
           }
      
           public String getTanim() {
                return tanim;
           }
      
           public void setTanim(String tanim) {
                this.tanim = tanim;
           }
      
           public EgitimTipi getEgitimTipi() {
                return egitimTipi;
           }
      
           public void setEgitimTipi(EgitimTipi egitimTipi) {
                this.egitimTipi = egitimTipi;
           }
      
           public Date getEgitimZamanIstegi() {
                return egitimZamanIstegi;
           }
      
           public void setEgitimZamanIstegi(Date egitimZamanIstegi) {
                this.egitimZamanIstegi = egitimZamanIstegi;
           }
      
           public Date getEgitimZamani() {
                return egitimZamani;
           }
      
           public void setEgitimZamani(Date egitimZamani) {
                this.egitimZamani = egitimZamani;
           }
      
           public String getAd() {
                return ad;
           }
      
           public void setAd(String ad) {
                this.ad = ad;
           }
      
           public String getEgitimVerecekKurum() {
                return egitimVerecekKurum;
           }
      
           public void setEgitimVerecekKurum(String egitimVerecekKurum) {
                this.egitimVerecekKurum = egitimVerecekKurum;
           }
      
           public Boolean getPlanli() {
                return planli;
           }
      
           public void setPlanli(Boolean planli) {
                this.planli = planli;
           }
      
           public void setHarcamaGerekli(Boolean harcamaGerekli) {
                this.harcamaGerekli = harcamaGerekli;
           }
      
           public Boolean getHarcamaGerekli() {
                return harcamaGerekli;
           }
      
           public void setEgitimKatilimcilari(List<Users> egitimKatilimcilari) {
                this.egitimKatilimcilari = egitimKatilimcilari;
           }
      
           public List<Users> getEgitimKatilimcilari() {
                return egitimKatilimcilari;
           }
      
           public void setEgitimDurumBilgisi(EgitimDurumBilgisi egitimDurumBilgisi) {
                this.egitimDurumBilgisi = egitimDurumBilgisi;
           }
      
           public EgitimDurumBilgisi getEgitimDurumBilgisi() {
                return egitimDurumBilgisi;
           }
      
           public void setEgitimDosya(EgitimDosya egitimDosya) {
                this.egitimDosya = egitimDosya;
           }
      
           public EgitimDosya getEgitimDosya() {
                return egitimDosya;
           }
      
           public void setAnketIslemi(AnketIslemi anketIslemi) {
                this.anketIslemi = anketIslemi;
           }
      
           public AnketIslemi getAnketIslemi() {
                return anketIslemi;
           }
      
           public void setEgitimRaporu(String egitimRaporu) {
                this.egitimRaporu = egitimRaporu;
           }
      
           public String getEgitimRaporu() {
                return egitimRaporu;
           }
      
           public void setEgitimYeri(EgitimYeri egitimYeri) {
                this.egitimYeri = egitimYeri;
           }
      
           public EgitimYeri getEgitimYeri() {
                return egitimYeri;
           }
      
           public void setAnketYapilacakmi(Boolean anketYapilacakmi) {
                this.anketYapilacakmi = anketYapilacakmi;
           }
      
           public Boolean getAnketYapilacakmi() {
                return anketYapilacakmi;
           }
      
      }
      





       + It didnt creat one
      
      @Entity
      @Name("unvan")
      @Table(name="OYS_UNVAN")
      public class Unvan extends AuditBase implements java.io.Serializable
      {
          
           /**
            * 
            */
           private static final long serialVersionUID = 1L;
      
           @Id
           @GeneratedValue(strategy = GenerationType.AUTO)
           @Column(name = "T_ID", precision = 22, scale = 0)
           @NotNull
           private Long id;
           
           @Column(name = "T_AD", length = 50)
           @Length(max = 50)
           private String ad;
           
           @ManyToOne(fetch = FetchType.LAZY)
           @JoinColumn(name = "T_USTUNVAN")
           private Unvan ustUnvan;
           
           @ManyToOne(fetch = FetchType.LAZY)
           @JoinColumn(name = "T_GOREVTANIMI")
           private Dokuman gorevTanimi;
      
           @OneToMany(fetch = FetchType.LAZY, targetEntity = Unvan.class, mappedBy = "ustUnvan")
           @OrderBy("ad ASC")
           private Set<Unvan> altUnvanlar = new HashSet<Unvan>(0);
           
           @OneToMany(fetch = FetchType.LAZY, targetEntity=Users.class, mappedBy = "unvan")
           @OrderBy("ad ASC")
           private Set<Users> users = new HashSet<Users>(0);
      
           public Long getId() {
                return id;
           }
      
           public void setId(Long id) {
                this.id = id;
           }
      
           public String getAd() {
                return ad;
           }
      
           public void setAd(String ad) {
                this.ad = ad.toUpperCase(LocaleSelector.instance().getLocale());
           }
      
           public Unvan getUstUnvan() {
                return ustUnvan;
           }
      
           public void setUstUnvan(Unvan ustUnvan) {
                this.ustUnvan = ustUnvan;
           }
      
           public Dokuman getGorevTanimi() {
                return gorevTanimi;
           }
      
           public void setGorevTanimi(Dokuman gorevTanimi) {
                this.gorevTanimi = gorevTanimi;
           }
      
           public Set<Unvan> getAltUnvanlar() {
                return altUnvanlar;
           }
      
           public void setAltUnvanlar(Set<Unvan> altUnvanlar) {
                this.altUnvanlar = altUnvanlar;
           }
      
           public Set<Users> getUsers() {
                return users;
           }
      
           public void setUsers(Set<Users> users) {
                this.users = users;
           }
      
           
               @Override
               public String toString() {
                   return "org.domain.kaliteyonsist.entity.unvan[id=" + id + "]";
               }
      }






        • 1. Re: create table issue
          csenes csenes Newbie


          persistence.xml





          <?xml version="1.0" encoding="UTF-8"?>
               <!-- Persistence deployment descriptor for dev profile -->
          <persistence xmlns="http://java.sun.com/xml/ns/persistence"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
               version="1.0">
          
               <persistence-unit name="kaliteyonsist">
                    <provider>org.hibernate.ejb.HibernatePersistence</provider>
                    <jta-data-source>kaliteyonsistDatasource</jta-data-source>
                    <properties>
          
          
          
                         <!--
                              <property name="hibernate.dialect"
                              value="org.hibernate.dialect.PostgreSQLDialect" />
                         -->
          
                         <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
                         <property name="hibernate.hbm2ddl.auto" value="update" />
                         <property name="hibernate.show_sql" value="true" />
                         <property name="hibernate.format_sql" value="true" />
                         <property name="jboss.entity.manager.factory.jndi.name"
                              value="java:/kaliteyonsistEntityManagerFactory" />
                         <property name="hibernate.transaction.manager_lookup_class"
                              value="org.hibernate.transaction.SunONETransactionManagerLookup" />
                    </properties>
               </persistence-unit>
          </persistence>
          



          • 2. Re: create table issue
            Leo van den berg Master

            Hi,


            Look in the log of the server and find the part where the tables are created. It possibly gives you an idea whta has happens. Also, be aware that you're using update and some things are NOT updated (for instance if you change a property type)


            If there is no error-message. Change to a new DB, change the hbm2dd.auto to create-drop and see whate happens.


            Leo