JPA - Oracle Spatial (JGeometry) Support

> Procedural Languages > Java

1 - About

TopLink, EclipseLink supports the SDO_GEOMETRY datatype using the JGeometryConverter (org.eclipse.persistence.platform.database.oracle.converters).

The Java fields in an entity should be of type oracle.spatial.geometry.JGeometry using the Oracle spatial library.

3 - Configuration

3.1 - Weblogic

Get the Java Spatial API in the lib directory of Weblogic:

  • To support Oracle Spatial, copy the jar sdoapi.jar to <WEBLOGIC_HOME>/server/lib

Extend the domain:

  • Download the toplink-spatial-template.jar (to support Oracle Spatial)
  • Launch the Config Wizard (<WEBLOGIC_HOME>/common/bin/config.sh (or .cmd).
  • Select Extend an existing WebLogic domain.
  • Browse and select your WebLogic Server domain.
  • Select Extend my domain using an existing extension template.
  • Browse and select the required template JAR (toplink-spatial-template.jar for Oracle Spatial
  • Complete the remaining pages of the wizard and finish

Preparing...
Extracting Domain Extension Contents...
Saving the Domain Information...
Updating Domain Information...
String Substituting Domain Files...
Performing OS Specific Tasks...
Performing Post Domain Creation Tasks...
Domain Extension Applied Successfully!

Domain Location: /bishiphome/Middleware/user_projects/domains/bifoundation_domain
Admin Server URL: http://demo.us.oracle.com:7001
  • Restart Weblogic
Advertising

4 - Annotation Example

@Entity
@Table(name="myName")
@StructConverter(name = "JGeometry", converter = 
"org.eclipse.persistence.platform.database.oracle.converters.JGeometryConverter")
public class Hotstar implements Serializable {
	private static final long serialVersionUID = 1L;
 
	@Convert(value="JGeometry")
	private JGeometry point;
 
	@Convert(value="JGeometry")
	@Column(name="POINT_90112")
	private JGeometry point90112;
 
....

5 - Support

5.1 - java.lang.NoClassDefFoundError: oracle/spatial/geometry/JGeometry

Exception in thread "main" javax.ejb.EJBException: EJB Exception: ; 
nested exception is: java.lang.NoClassDefFoundError: oracle/spatial/geometry/JGeometry; 
nested exception is: java.rmi.RemoteException: EJB Exception: ; 
nested exception is: java.lang.NoClassDefFoundError: oracle/spatial/geometry/JGeometry

You must complete the configuration of your application server.

6 - Documentation / Reference

lang/java/jpa_oracle_spatial.txt · Last modified: 2017/02/12 21:06 by gerardnico