[postgis-users] RE: RE: RE: PostGIS - hibernate - EJB3
coster
christian.osterrieder at salzburgresearch.at
Fri Oct 6 02:53:15 PDT 2006
Hi Norman,
thank you for your tutorial!
Storing data in a geometry column works fine if I create a new object and
persist it with the entity manager.
But if I try to edit the data with 'merge' from the database manager its not
working:
PersonEntity pe = entityManager.find(PersonEntity.class, new
Long(1).longValue());
pe.setLocation(new Point(8,5));
entityManager.merge(pe);
How can I fix this problem?
And their is a NullPointerException if I try to read a list of data from the
database:
public Object nullSafeGet(ResultSet resultSet,
String[] names, Object owner) throws HibernateException,
SQLException {
Geometry result = null;
String geom = resultSet.getString(names[0]);
try{
BinaryParser parser = new BinaryParser();
result = parser.parse(geom);
}
catch(NullPointerException e){
logger.error("nullSafeGet() geom result"+geom);
}
return result;
}
Tank you for your help,
Christian.
Norman Barker-3 wrote:
>
> Hi,
>
> I have been a bit busy, but it is my intention to write a simple 'spatial'
> tutorial on EJB3 using the postgis geometry type, the functionality will
> be simple but should get you started. I know I said I would have it done
> by last w/end so I will put it top on my priority list.
>
> Apologies for the delay, posting code with no instructions is bad!
>
> Norman
>
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net on behalf of coster
> Sent: Tue 9/5/2006 6:49 AM
> To: postgis-users at postgis.refractions.net
> Subject: [postgis-users] RE: RE: PostGIS - hibernate - EJB3
>
>
> hi,
> I have the same problem with JBoss and EJB3.
> The column is type "oid" instead of "geometry".
>
> I would be very grateful for a solution - here are my postgis-ds.xml and
> my
> persistence.xml:
>
> <datasources>
> <local-tx-datasource>
> <jndi-name>PostgisDS</jndi-name>
> <connection-url>jdbc:postgresql://xxx:5432/tourguide</connection-url>
> <driver-class>org.postgis.DriverWrapper</driver-class>
> <user-name>xxx</user-name>
> <password>xxx</password>
> <new-connection-sql>select 1</new-connection-sql>
> <check-valid-connection-sql>select 1</check-valid-connection-sql>
> <metadata>
> <type-mapping>PostgreSQL 8.1</type-mapping>
> </metadata>
> </local-tx-datasource>
> </datasources>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence xmlns="http://java.sun.com/xml/ns/persistence">
> <persistence-unit name="tourguide">
> <jta-data-source>java:/PostgisDS</jta-data-source>
> <properties>
> <property name="hibernate.dialect"
> value="org.hibernate.dialect.PostgreSQLDialect"/>
> <property name="hibernate.hbm2ddl.auto" value="update"/>
> <property name="hibernate.show_sql" value="true"/>
> </properties>
> </persistence-unit>
> </persistence>
>
> Thanks!
> Christian.
>
>
> Norman Barker-3 wrote:
>>
>>
>>
>> -----Original Message-----
>> From: postgis-users-bounces at postgis.refractions.net
>> [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
>> croisfert
>> Sent: Monday, August 21, 2006 2:54 AM
>> To: postgis-users at postgis.refractions.net
>> Subject: [postgis-users] RE: PostGIS - hibernate - EJB3
>>
>>
>> hi, I am trying to use custom UserType, but it work fine in a pure
>> Hibernate
>> implementation , but not in JBOSS EJB3, the generated geometry column in
>> postgres is of type "oid" instead of "geometry" You have any
>> suggestion,
>> i am using jboss-EJB-3.0_RC8-FD and postgis 1.1.3 (on postgres 8.1.4)
>>
>>
>> thanks.
>> --
>>
>>
>> Make sure that the usertype is available on your classpath, I have only
>> tested it with the Geometry Column type (as the name implies!!), I also
>> set up postgis as a datasource within JBoss - postgis-ds.xml, and
>> configured the persistence.xml. I am writing up a doc for this shortly;
>> just don't have too much time this week.
>>
>> Norman
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/PostGIS---hibernate---EJB3-tf2064211.html#a6146402
> Sent from the PostGIS - User forum at Nabble.com.
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
--
View this message in context: http://www.nabble.com/PostGIS---hibernate---EJB3-tf2064211.html#a6676142
Sent from the PostGIS - User mailing list archive at Nabble.com.
More information about the postgis-users
mailing list