Re: About Database Vender Independent for WebObjects.
Re: About Database Vender Independent for WebObjects.
- Subject: Re: About Database Vender Independent for WebObjects.
- From: steve stout <email@hidden>
- Date: Mon, 31 Jan 2005 14:39:06 -0800
Looks to me like all you want to do is have the JGeometry object
serialized in some form in the database. You can just add new getter
and setter methods that serialize the object for you before passing it
off to a String which gets saved in the db.
For example...
In EOModeler create the attribute geometryAsString, map it to a field
in the db, and set the type to String. Then generate java files for
your entity.
You should then have a MySpecialEO.java (or whatever) with getter and
setter methods for your attribute. Something like geometryAsString()
and setGeometryAsString(). These will access the String representation
of the JGeometry object.
You need to add another set of getters and setters that take a
JGeometry type. So add the following to the class.
public JGeometry getGeometry() {
String geometryString = this.geometryAsString();
// code to deserialize the object
JGeometry jg = theMagicDeserializer(geometryString);
return jg;
}
public void setGeometry(JGeometry jg) {
// code to serialize the object
String geometryString = theMagicSerializer(jg);
this.setGeometryAsString(geometryString);
}
The key to making this work correctly is not simply overriding
getGeometryAsString to return a JGeometry, WO still needs to access
that method as a String. Also note that the geometry() attribute isn't
in the EOModel, but when working with the EO in your code you can
pretend that it is.
The only part that's left up to you to figure out is how to serialize
the JGeometry object as a string, which should be easy to do.
Hope that helps a bit.
.steve
On Jan 30, 2005, at 7:09 PM, Marina Zheng wrote:
We use Oracle existing plungin's, "ojdbc14.jar" and
"sdoapi.jar". WO may includ ojdbc14.jar but I don't
think it has sdoapi.jar by default.
So you mean if I include sdoapi.jar(containing class
"JGeometry") into EOF, EOF will then be able to use
JGeometry type to map to Geometry data type from db? I
doubt it that WO will know how to read it first to
Oracle.sql.Struct and then load it to JGeometry type
though.
Any way, what I really want to know is if you can
actuall modify Enterprise Object after it's generated
by EOF. If not, it's then impossible to use EOF for
Geometry type. You must then be able to manually
create an EO from scratch and enbed some SQL scripts
to do the job.
Maybe I sound confusing here with this too...never
mind then.
Thanks a lot, Dov and own.
--marina
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden