4 Replies Latest reply on Nov 11, 2008 7:37 PM by www.supernovasoftware.com

    Entity views with postgres

    micayael

      Hi.


      I'm trying to make an entity view using postgres using



      @Entity
      @Table(name - testview)
      // note: that - its an equals



      but I found this error: Missing table: testview.


      somebody can help me?

        • 1. Re: Entity views with postgres
          trunikov.dmitry.trunikov.zoral.com.ua

          May be you should add an attribute 'schema'.



          @Entity
          @Table(name = "usr", schema = "public", uniqueConstraints = @UniqueConstraint(columnNames = "uname"))
          ...
          


          • 2. Re: Entity views with postgres
            micayael
            I got the same error: table not found.

            I found this url http://www.guj.com.br/posts/list/75664.java

            Here said that I have to delete the line <property name="hibernate.hbm2ddl.auto" value="validate"/> of the persistence.xml.

            But, is this correct?
            • 3. Re: Entity views with postgres
              stefanotravelli

              If you want Seam (that is Hibernate) to create your database schema you have to set that parameter to 'update' or 'create':



              <property name="hibernate.hbm2ddl.auto" value="update"/>



              Setting to 'validate' it just... well, validate, and the result of the validation is that the table doesn't exist.

              • 4. Re: Entity views with postgres
                www.supernovasoftware.com

                If you are trying to map a view you must upgrade hibernate to 3.2.6.


                I had to do this in order to keep validate on due to the way postgres reports tables.


                I have seen no problems by upgrading JBAS 4.2.3 to this version of hibernate.


                Specifically I had to copy the relevant versions of 3.2.6 jars


                hibernate3.jar
                hibernate-annotations.jar
                hibernate-commons-annotations.jar
                hibernate-entitymanager.jar
                hibernate-validator.jar




                to


                /jboss-4.2.3.GA/server/default/lib