Hi Riccardo,

On 2011-08-11, at 3:53 AM, Riccardo De Menna wrote:

> Hi there,
> 
> Is there a way to force the db adaptor to serialize and deserialize objects 
> using java.io.Serializable?
> To put it in other words, is there an easy way to serialize simple java 
> objects without the need to write customized code?

No.  :-)

Kieran has a related blog post: 
http://homepage.mac.com/kelleherk/iblog/C729512539/E2033071041/index.html

The summary is that EOF provides for non-Java serialization using these 
attribute properties set in Entity Modeler:
Class:
Factory Method::
Conversion Method:
Init Argument:


> For example, I was tweaking some of my prototypes and I just realized that it 
> would be very useful to have an inetAddress prototype for all ip/host 
> addresses. The class for it is java.net.InetAddress and it obviously already 
> implements Serializable. Can I leverage that in entity modeler to save and 
> restore those objects to blobs without having to write a serialization 
> utility?

You may get this to work by using getByName as the factory method and 
getHostName as the conversion method.  Otherwise you need to wrap classes like 
this to serialize and de-serialize using this method OR somehow change EOF to 
do other serialization (probably possible, probably not easy).


> Also, why is the "class" field always disabled in entity modeler when the 
> "value class" is visible?

Because that is only for the custom serialization as above.


> If there is no automatic way to deserializae using Serializable, then I was 
> thinking of writing a custom serialization class.

Patches welcome.  :-)


> I though I could use the "class" field to point to my deserialization class, 
> the "value class" field to tell the system what to expect as a final output, 
> and the "value type" field to help my class decide "how" to deserialize. But 
> the class field is always grayed out and disabled and I can't find any 
> documentation on how I would have to write my code.

Entity Modeler is setup to support what EOF expects which is not what you plan. 
 The com.webobjects.jdbcadaptor.JDBCPlugIn class is one place to start looking 
if you want to try modifying EOF.


Chuck


-- 
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.    
http://www.global-village.net/products/practical_webobjects







 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to