• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: About Database Vender Independent for WebObjects.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About Database Vender Independent for WebObjects.


  • Subject: Re: About Database Vender Independent for WebObjects.
  • From: Dov Rosenberg <email@hidden>
  • Date: Sun, 30 Jan 2005 20:04:28 -0500

Oracle has several non sql 92 datatypes. In addition, you can define your
own datatypes and use them like you would a native datatype. I suspect you
would have to create a new JDBCPlugin to handle those non standard types/
You could probably base it off of the existing Oracle Plugin.


--
Dov Rosenberg
Conviveon Corporation
http://www.conviveon.com




On 1/30/05 7:22 PM, "Owen McKerrow" <email@hidden> wrote:

> Sorry still a little unclear, is Geometry a standard Oracle type ? i.e.
> like a VAr or an INT  ?
>
>
> On 31/01/2005, at 11:04 AM, java mouse wrote:
>
>> Hi Owen,
>>  
>>   Thank you very much for the reply.
>>  
>>   I don't know exactly how to use EOF and code for it, but I think I
>> know the idea of it. I'll really start to get my hands dirty once I
>> decide to go with WO.
>>   
>>   However, Geometry is not one ROW in the table, it's a data type of
>> one COLUMN. Say I have the following table:
>>  
>>   Table Name: tb_address
>>   address_id: int
>>   street: Varchar[100]
>>   city: Varchar[100]
>>   state: Char[2]
>>   location: Geometry  --> which saves the latitude and longitude of
>> the address as Geometry
>>  
>> So when this table is mapped to an Enterprise Objects, it should have
>> a field for "location" of Geometry type, with a getter and a setter:
>>  
>>   public JGeometry getLocation(){
>>       /*
>>       Step1: ResultSet rsLoc =  statement.executeQuery("Select
>> location from tb_address ....");
>>       Step2: Struct objLocation = (oracle.sql.STRUCT)rs.getObject(1);
>>       Step3: JGeometry jgLocation = JGeometry.load(objLocation);
>>       Step4: Return jgLocation;
>>       */
>>   }
>>  
>>   public void setLocation(JGeometry jgLocation){
>>      //........(some validation check);
>>      this._jgLocation = jgLocation;
>>   }
>>  
>>   And to save JGeometry to db:
>> Step1: PreparedStatement ps = connection.prepareStatement("UPDATE
>> tb_address set location=? where ...");
>> Step2: STRUCT obj = JGeometry.store(jgLocation, dbConnection);
>> Step3: ps.setObject(1, obj);
>> Step4: ps.execute();
>>  
>>   Both "Struct" and "JGeometry" are in a sdoapi.jar provided by
>> Oracle, meaning they are proprietary. It also has to use
>> PreparedStatement other than just normal resultset or one simple SQL
>> script. This is what make me really doubt it that EOF can handle it
>> all by itself. You'll have to be able to actually modify the generated
>> Enterprise Object file to do this.
>>  
>> It's also why we can't just use CMP(container will manage the state
>> for you), but having to use BMP(you write your own persistance code).
>> In my last post, I actually meant I wrote trigger so that we could
>> still use CMP without having to write all this persistance code.
>>  
>> Very lengthy. Sorry for that.
>>   
>> Once again, thank you very much. :-)
>>  
>> Regards,
>> --marina
>>  
>>  
>>   
>>
>> Owen McKerrow <email@hidden> wrote:
>> Hi Marina,
>>
>> Im not an Oracle expert ( or indeed user ) but if I understand your
>>  question correctly, when you take a row from a table in the DB, in
>> this
>>  case a Gemoetry, EOF turns it into a instance of a JGeometry with its
>> attributes set to the same values as the values in the DB. You then use
>>  this instance like a normal java object. Lets say you want to change
>>  the attribute Name, from "jones" to "Smith", so as you would expect
>> you
>>  would write...
>>
>> myGeometryObject.setName("Smith");
>>
>> Vanilla java stuff.
>>
>> Then you want to save this change back to the DB, you would use the
>>  following line.
>>
>> ec.saveChanges();
>>
>> And thats it. That one line will take your changes and save them back
>>  to the database. No SQL needs to be made by you, WO and EOF do that
>> for
>> you.
>>
>> Now let me explain the above line of code, without g! oing to deep into
>>  belly of WO :)
>>
>> In WO you have a thing called an EditingContext , this editing context
>>  is what you use when you want to fetch from and save to the DB. You
>> ask
>>  it to get you data from the DB which it then converts into instances
>> of
>> Java Objects and hands these back to you. After you have made changes
>>  to your object you then ask the editing context to write these changes
>>  back to the DB. Thats what that line of code is doing, ec is an
>> instance of an editing context and Im asking it to save its changes.
>> One thing to point out, that once the editing context has fetched the
>>  data from the database, it continues to watch the objects that its has
>>  made and thus knows when an object has changed. So when you ask it to
>> save its changes it looks at all the objects its watching, check which
>>  ones details have changed and then saves them all in one go.
>>
>>
>>
>>
>> On 31/01/2005, at 10:01 AM, java mouse wrote:
>>
>>> An! other question is: one should be able to edit an Enterprise
>> Object
>>> file(a java class file is generated right?), right?
>>>  
>>> The reason is: what happen if there's some proprietary type to map
>>> like Oracle Spatial has a "Geometry" data type, with an jar
>> containing
>>> "JGeometry" accordingly(So you read Geometry from db into JGeometry
>>> java object, this has to be done with manually coding SQL scripts).
>>>  
>>> For J2EE, you'll have to use BMP instead of CMP so as to manually
>>> write SQL scripts to fetch & save Geometry, but I don't know how you
>>> would handle it in WO? (In my real project, I actually used Trigger,
>>> so that I still used BMP for Geometry.)
>>>  
>>> Thanks for kindly reply,
>>> --marina
>>>
>>>
>>> Dov Rosenberg wrote:
>>> If you want to support multiple databases I would stay away from
>>> stored procedures ­ these! are very vendor specific. WebObjects/EOF
>>> makes it much easier to support multiple databases because EOF is an
>>> Object Relational mapping tool that abstracts the database from the
>>> source code. EOPrototypes are very useful is supporting multiple
>>> databases. Check out Practical WebObjects from Chuck Hill (Apress
>>> Books). It is a very good book that goes way beyond product manuals.
>>>
>>>
>>> --
>>> Dov Rosenberg
>>> Conviveon Corporation
>>> http://www.conviveon.com
>>>
>>>
>>>
>>>
>>> On 1/30/05 3:53 AM, "java mouse" wrote:
>>>
>>>
>>> I read that WebObjects data-driven application can change its
>> database
>>> without a single line of code, and I also read that WO app. actually
>>> support the use of StoredProcedure.
>>>  
>>> My question is: how does it achieve database nuetral with the
>>> storedprocedure?
>>>  
>>> Than! ks a lot,
>>> -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
>>>
>>>
>>>
>>> Dov Rosenberg wrote:
>>> If you want to support multiple databases I would stay away from
>>> stored procedures ­ these are very vendor specific. WebObjects/EOF
>>> makes it much easier to support multiple databases because EOF is an
>>> Object Relati! onal mapping tool that abstracts the database from the
>>> source code. EOPrototypes are very useful is supporting multiple
>>> databases. Check out Practical WebObjects from Chuck Hill (Apress
>>> Books). It is a very good book that goes way beyond product manuals.
>>>
>>>
>>> --
>>> Dov Rosenberg
>>> Conviveon Corporation
>>> http://www.conviveon.com
>>>
>>>
>>>
>>>
>>> On 1/30/05 3:53 AM, "java mouse" wrote:
>>>
>>>
>>> I read that WebObjects data-driven application can change its
>> database
>>> without a single line of code, and I also read that WO app. actually
>>> support the use of StoredProcedure.
>>>  
>>> My question is: how does it achieve database nuetral with the
>>> storedprocedure?
>>>  
>>> Thanks a lot,
>>> -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 you Yahoo!?
>>> Yahoo! Mail - now with 250MB free storage. Learn more.
>>> _______________________________________________
>>> 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
>> Owen McKerrow
>> WebMaster, emlab
>> http://emlab.uow.edu.au
>>
>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> - - - - - - - -
>>
>> "I like the way this project has somehow, against all common sense, got
>>  itself made."
>> - Peter Jackson, "The Lord of The Rings"
>>
>>
>> __________________________________________________
>> Do You Yahoo!?
>> Tired of spam? Yahoo! Mail has the best spam protection around
>> http://mail.yahoo.com
>>
> Owen McKerrow
> WebMaster, emlab
> http://emlab.uow.edu.au
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - - - - - - -
>
> "I like the way this project has somehow, against all common sense, got
> itself made."
> - Peter Jackson,  "The Lord of The Rings"
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> n.com
>
> 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

  • Follow-Ups:
    • Re: About Database Vender Independent for WebObjects.
      • From: Marina Zheng <email@hidden>
References: 
 >Re: About Database Vender Independent for WebObjects. (From: Owen McKerrow <email@hidden>)

  • Prev by Date: Re: About Database Vender Independent for WebObjects.
  • Next by Date: Re: WebObject's J2EE Support.
  • Previous by thread: Re: About Database Vender Independent for WebObjects.
  • Next by thread: Re: About Database Vender Independent for WebObjects.
  • Index(es):
    • Date
    • Thread