1

I'm developing a GEO based app using PostGIS and Hibernate and I'm stuck on persistence units. I have entities with and without GIS attributes. And my persistence.xml is this:

<persistence-unit name="unitName" transaction-type="JTA">
    <jta-data-source>java:jboss/datasources/PostgresDS</jta-data-source>
    <class>entity.PersistentEntity.Account</class>
    <class>entity.PersistentEntity.Score</class>
    <properties>
        <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL82Dialect"/>
        <property name="hibernate.show_sql" value="true"/>
        <property name="hibernate.format_sql" value="false"/>
        <property name="hibernate.hbm2ddl.auto" value="update"/>
    </properties>
</persistence-unit>

<persistence-unit name="gisUnitName" transaction-type="JTA">
    <jta-data-source>java:jboss/datasources/PostgresDS</jta-data-source>
    <class>entity.PersistentEntity.Login</class>
    <properties>
        <property name="hibernate.dialect" value="org.hibernate.spatial.dialect.postgis.PostgisDialect"/>
        <property name="hibernate.show_sql" value="true"/>
        <property name="hibernate.format_sql" value="false"/>
        <property name="hibernate.hbm2ddl.auto" value="update"/>
    </properties>
</persistence-unit>
  1. Should I isolate all entites that have GIS attributes on one specific persistence unit?

  2. Should I have different persistence units pointing to the same database?

I didn't find any good tutorial neither documentation pointing towards this kind of question. I don't know if I'm thinking something wrong or if there's same lack of documentation.

rado
  • 5,720
  • 5
  • 29
  • 51

0 Answers0