You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by Atul Dambalkar <ad...@cisco.com> on 2001/08/28 19:49:54 UTC

Using peer classes for DatabasePsmlManagerService Implementation

Hi,

As you may know, I am working on DatabasePsmlManager implementation. At 
first I was concentrating on the interface definitions and since now, that 
is getting along quite well, I am now trying to concentrate on supporting 
different types of databases on the same lines as turbine does.

I was going thro' Turbine documentation, and coming to a conclusion that in 
order to achieve full database independence, we need to use Peer classes in 
Jetspeed for the Database Tables we proposed (currently for Oracle). I need 
some help related to generating and using Peer classes.

0. Do I need to use peer classes?
If yes:
   0. How should I generate peer classes? The only way to generate peer 
classes is thro' build.xml, that is available in Turbine
   1. I guess, I will also have to write MapBuilder class similar to 
TurbineMapBuilder.
   2. How does, map builder figures out about usage of database SEQUENCE or 
AUTO INCREMENT columns
else:
   0. Is only Village API sufficient for handling all the database operations?
   1. I guess, figuring out SEQUENCE or AUTO INCREMENT is not possible 
thro' Village API

Thanks.

-Atul


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Re: Using peer classes for DatabasePsmlManagerService Implementation

Posted by Jon Stevens <jo...@latchkey.com>.
on 9/4/01 4:28 PM, "Atul Dambalkar" <ad...@cisco.com> wrote:

> At 03:35 PM 9/4/01 -0700, you wrote:
>> on 9/4/01 12:01 PM, "Atul Dambalkar" <ad...@cisco.com> wrote:
>> 
>>> I am now using stand-alone Torque for the database table SQL and OM
>>> generation.
>>> 
>>> I could generate the Peer classes, with idMethod="idbroker" but if I try to
>>> use "idMethod=native" it fails with the following message:
>>> ===================
>>> Error Line: 39 Row: 57 Msg: Attribute "idMethod" with value "native" must
>>> have a value from the list "(idbroker|autoincrement|sequence|none|null)".
>>> ====================
>>> 
>>> Apparently, it looks that, the Torque2.1 release build doesn't seem to
>>> support "native" value. Documentation is a bit confusing. Or do I have to
>>> download a different version?
>>> 
>>> -Atul
>> 
>> Correct. 2.1 does not support native. It is supported in the CVS version of
>> Torque as it is a new feature.
> 
> I did try that with the CVS version, but, CVS version is quite confusing.
> In it's README file it shows directory structure as:
> =============================
> Torque is an Object/Relational persistence layer.
> 
> bin/        Temporary directory for building the project.
> build/      Location of Ant build.xml and build.properties files.
> examples/   Example XML Torque schemas that are part of the distribution.
> src/        Location of Java sources and Torque templates.
> xdocs/      Torque documention in Anakia formatted tags.
> ===========================
> 
> and in reality, there are no "build" and "bin" directories under
> "jakarta-turbine-torque" module. I hope that's the module for the
> stand-alone version. http://cvs.apache.org/viewcvs/jakarta-turbine-torque/

Yes, it is the future of Torque and is in development. It is currently very
stable however. Patches to improve the documentation are always welcome.
Thanks for volunteering.

> Cool! That's what I am doing now..., Please see my last email. Of-course,
> "native" would have also worked fine for me, as I really wanted to get rid
> of any sequence/auto-increment related stuff.

Well, then use the CVS version if you want 'native'. Otherwise, you are
going to have to wait until our next release.

You can always look at Scarab for an example of how we use the latest
versions of Torque.

    <http://scarab.tigris.org/>

thanks,

-jon


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Re: Using peer classes for DatabasePsmlManagerService Implementation

Posted by Atul Dambalkar <ad...@cisco.com>.
At 03:35 PM 9/4/01 -0700, you wrote:
>on 9/4/01 12:01 PM, "Atul Dambalkar" <ad...@cisco.com> wrote:
>
> > I am now using stand-alone Torque for the database table SQL and OM
> > generation.
> >
> > I could generate the Peer classes, with idMethod="idbroker" but if I try to
> > use "idMethod=native" it fails with the following message:
> > ===================
> > Error Line: 39 Row: 57 Msg: Attribute "idMethod" with value "native" must
> > have a value from the list "(idbroker|autoincrement|sequence|none|null)".
> > ====================
> >
> > Apparently, it looks that, the Torque2.1 release build doesn't seem to
> > support "native" value. Documentation is a bit confusing. Or do I have to
> > download a different version?
> >
> > -Atul
>
>Correct. 2.1 does not support native. It is supported in the CVS version of
>Torque as it is a new feature.

I did try that with the CVS version, but, CVS version is quite confusing. 
In it's README file it shows directory structure as:
=============================
Torque is an Object/Relational persistence layer.

bin/        Temporary directory for building the project.
build/      Location of Ant build.xml and build.properties files.
examples/   Example XML Torque schemas that are part of the distribution.
src/        Location of Java sources and Torque templates.
xdocs/      Torque documention in Anakia formatted tags.
===========================

and in reality, there are no "build" and "bin" directories under 
"jakarta-turbine-torque" module. I hope that's the module for the 
stand-alone version. http://cvs.apache.org/viewcvs/jakarta-turbine-torque/


>"autoincrement" and "sequence" is deprecated in the new version because it
>doesn't make sense to hard code specific database related information into
>the .xml file.

That's correct.

>I believe that you said earlier that you wanted to use the idbroker, so that
>is the right thing to put in there. Either way, I would use idbroker all the
>time anyway...in some ways, it is better to always use an idbroker instead
>of the native because idbroker can be smart about giving out id's as well as
>save hits to the database (ie: to retrieve the last inserted value).

Cool! That's what I am doing now..., Please see my last email. Of-course, 
"native" would have also worked fine for me, as I really wanted to get rid 
of any sequence/auto-increment related stuff.

-Atul


>-jon
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Re: Using peer classes for DatabasePsmlManagerService Implementation

Posted by Jon Stevens <jo...@latchkey.com>.
on 9/4/01 12:01 PM, "Atul Dambalkar" <ad...@cisco.com> wrote:

> I am now using stand-alone Torque for the database table SQL and OM
> generation.
> 
> I could generate the Peer classes, with idMethod="idbroker" but if I try to
> use "idMethod=native" it fails with the following message:
> ===================
> Error Line: 39 Row: 57 Msg: Attribute "idMethod" with value "native" must
> have a value from the list "(idbroker|autoincrement|sequence|none|null)".
> ====================
> 
> Apparently, it looks that, the Torque2.1 release build doesn't seem to
> support "native" value. Documentation is a bit confusing. Or do I have to
> download a different version?
> 
> -Atul

Correct. 2.1 does not support native. It is supported in the CVS version of
Torque as it is a new feature.

"autoincrement" and "sequence" is deprecated in the new version because it
doesn't make sense to hard code specific database related information into
the .xml file.

I believe that you said earlier that you wanted to use the idbroker, so that
is the right thing to put in there. Either way, I would use idbroker all the
time anyway...in some ways, it is better to always use an idbroker instead
of the native because idbroker can be smart about giving out id's as well as
save hits to the database (ie: to retrieve the last inserted value).

-jon


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Re: Using peer classes for DatabasePsmlManagerService Implementation

Posted by Atul Dambalkar <ad...@cisco.com>.
I am now using stand-alone Torque for the database table SQL and OM generation.

I could generate the Peer classes, with idMethod="idbroker" but if I try to 
use "idMethod=native" it fails with the following message:
===================
Error Line: 39 Row: 57 Msg: Attribute "idMethod" with value "native" must 
have a value from the list "(idbroker|autoincrement|sequence|none|null)".
====================

Apparently, it looks that, the Torque2.1 release build doesn't seem to 
support "native" value. Documentation is a bit confusing. Or do I have to 
download a different version?

-Atul

At 10:43 AM 8/31/01 -0700, you wrote:
>At 07:56 PM 8/30/01 -0700, you wrote:
>>on 8/30/01 2:56 PM, "Atul Dambalkar" <ad...@cisco.com> wrote:
>>
>> > Well, I thought, it may be just an over-kill as the schema is pretty 
>> simple
>> > and there are no complex database operations like inner/outer joins...
>> >
>> > -Atul
>>
>>Torque works well in both situations.
>
>Great!  May be it was my in-experience with Torque.
>
>>The benefit of Torque isn't in making things less complex, it is in
>>providing code maintainability over the long term as well as providing a set
>>of BO's that you can add your application logic into.
>>
>>I would say that even a 1 table database should still use Torque.
>
>
>Cool...I will learn Torque in next couple of days, will have to get back 
>to you, as I will have plenty of doubts.
>
>-Atul
>
>
>>-jon
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Re: Using peer classes for DatabasePsmlManagerService Implementation

Posted by Atul Dambalkar <ad...@cisco.com>.
At 07:56 PM 8/30/01 -0700, you wrote:
>on 8/30/01 2:56 PM, "Atul Dambalkar" <ad...@cisco.com> wrote:
>
> > Well, I thought, it may be just an over-kill as the schema is pretty simple
> > and there are no complex database operations like inner/outer joins...
> >
> > -Atul
>
>Torque works well in both situations.

Great!  May be it was my in-experience with Torque.

>The benefit of Torque isn't in making things less complex, it is in
>providing code maintainability over the long term as well as providing a set
>of BO's that you can add your application logic into.
>
>I would say that even a 1 table database should still use Torque.


Cool...I will learn Torque in next couple of days, will have to get back to 
you, as I will have plenty of doubts.

-Atul


>-jon
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Re: Using peer classes for DatabasePsmlManagerService Implementation

Posted by Jon Stevens <jo...@latchkey.com>.
on 8/30/01 2:56 PM, "Atul Dambalkar" <ad...@cisco.com> wrote:

> Well, I thought, it may be just an over-kill as the schema is pretty simple
> and there are no complex database operations like inner/outer joins...
> 
> -Atul

Torque works well in both situations.

The benefit of Torque isn't in making things less complex, it is in
providing code maintainability over the long term as well as providing a set
of BO's that you can add your application logic into.

I would say that even a 1 table database should still use Torque.

-jon


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Re: Using peer classes for DatabasePsmlManagerService Implementation

Posted by Atul Dambalkar <ad...@cisco.com>.

At 01:56 PM 8/30/01 -0700, you wrote:
>on 8/30/01 10:32 AM, "Atul Dambalkar" <ad...@cisco.com> wrote:
>
> > I am thinking about concentrating on defining such a schema that will get
> > easily mapped on to all databases, no SEQUENCE or any proprietary database
> > specific stuff, and follow Turbine by defining a separate ID_TABLE to store
> > the primary keys for rest of the tables. Then query ID_TABLE at start-up.
> > That way I will only have to use Village API. I am working on the Schema
> > tweaking a bit. What do you think on this approach? I am trying to get
> > information from people who have better database knowledge than me.
>
>Just use Torque. It is a much better solution than using bare bones Village.
>If you define idMethod="native" in Torque, then it will cause your system to
>use whatever method is native for each database to do auto-increment.
>
>If you define idMethod="idBroker", then Torque will use the IDBroker and the
>ID_TABLE.

Okay great! I will now drill through Torque.

>I don't understand why you are proposing re-implementing this wheel or doing
>things differently.

Well, I thought, it may be just an over-kill as the schema is pretty simple 
and there are no complex database operations like inner/outer joins...

-Atul

>-jon
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Re: Using peer classes for DatabasePsmlManagerService Implementation

Posted by Jon Stevens <jo...@latchkey.com>.
on 8/30/01 10:32 AM, "Atul Dambalkar" <ad...@cisco.com> wrote:

> I am thinking about concentrating on defining such a schema that will get
> easily mapped on to all databases, no SEQUENCE or any proprietary database
> specific stuff, and follow Turbine by defining a separate ID_TABLE to store
> the primary keys for rest of the tables. Then query ID_TABLE at start-up.
> That way I will only have to use Village API. I am working on the Schema
> tweaking a bit. What do you think on this approach? I am trying to get
> information from people who have better database knowledge than me.

Just use Torque. It is a much better solution than using bare bones Village.
If you define idMethod="native" in Torque, then it will cause your system to
use whatever method is native for each database to do auto-increment.

If you define idMethod="idBroker", then Torque will use the IDBroker and the
ID_TABLE.

I don't understand why you are proposing re-implementing this wheel or doing
things differently.

-jon


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


RE: Using peer classes for DatabasePsmlManagerService Implementation

Posted by Atul Dambalkar <ad...@cisco.com>.
Hi David,

At 10:57 PM 8/29/01 -0700, you wrote:
>Hi Atul,
>
>Look at Torque. It will generate a lot of the code that you need.

I am thinking about concentrating on defining such a schema that will get 
easily mapped on to all databases, no SEQUENCE or any proprietary database 
specific stuff, and follow Turbine by defining a separate ID_TABLE to store 
the primary keys for rest of the tables. Then query ID_TABLE at start-up. 
That way I will only have to use Village API. I am working on the Schema 
tweaking a bit. What do you think on this approach? I am trying to get 
information from people who have better database knowledge than me.


>Hope you had a good vacation :)

Yep. It was fun. But, as always it was a bit exhausting in India.

Thanks,

-Atul


>David
>
>
>
>
> > -----Original Message-----
> > From: Atul Dambalkar [mailto:adambalk@cisco.com]
> > Sent: Tuesday, August 28, 2001 10:50 AM
> > To: jetspeed-dev@jakarta.apache.org
> > Cc: david@bluesunrise.com; jmcnally@collab.net; jon@latchkey.com
> > Subject: Using peer classes for DatabasePsmlManagerService
> > Implementation
> >
> >
> > Hi,
> >
> > As you may know, I am working on DatabasePsmlManager
> > implementation. At
> > first I was concentrating on the interface definitions and
> > since now, that
> > is getting along quite well, I am now trying to concentrate
> > on supporting
> > different types of databases on the same lines as turbine does.
> >
> > I was going thro' Turbine documentation, and coming to a
> > conclusion that in
> > order to achieve full database independence, we need to use
> > Peer classes in
> > Jetspeed for the Database Tables we proposed (currently for
> > Oracle). I need
> > some help related to generating and using Peer classes.
> >
> > 0. Do I need to use peer classes?
> > If yes:
> >    0. How should I generate peer classes? The only way to
> > generate peer
> > classes is thro' build.xml, that is available in Turbine
> >    1. I guess, I will also have to write MapBuilder class similar to
> > TurbineMapBuilder.
> >    2. How does, map builder figures out about usage of
> > database SEQUENCE or
> > AUTO INCREMENT columns
> > else:
> >    0. Is only Village API sufficient for handling all the
> > database operations?
> >    1. I guess, figuring out SEQUENCE or AUTO INCREMENT is not
> > possible
> > thro' Village API
> >
> > Thanks.
> >
> > -Atul
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org
> >
> >
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


RE: Using peer classes for DatabasePsmlManagerService Implementation

Posted by David Sean Taylor <da...@bluesunrise.com>.
Hi Atul, 

Look at Torque. It will generate a lot of the code that you need.

Hope you had a good vacation :)

David
 

 

> -----Original Message-----
> From: Atul Dambalkar [mailto:adambalk@cisco.com]
> Sent: Tuesday, August 28, 2001 10:50 AM
> To: jetspeed-dev@jakarta.apache.org
> Cc: david@bluesunrise.com; jmcnally@collab.net; jon@latchkey.com
> Subject: Using peer classes for DatabasePsmlManagerService
> Implementation
> 
> 
> Hi,
> 
> As you may know, I am working on DatabasePsmlManager 
> implementation. At 
> first I was concentrating on the interface definitions and 
> since now, that 
> is getting along quite well, I am now trying to concentrate 
> on supporting 
> different types of databases on the same lines as turbine does.
> 
> I was going thro' Turbine documentation, and coming to a 
> conclusion that in 
> order to achieve full database independence, we need to use 
> Peer classes in 
> Jetspeed for the Database Tables we proposed (currently for 
> Oracle). I need 
> some help related to generating and using Peer classes.
> 
> 0. Do I need to use peer classes?
> If yes:
>    0. How should I generate peer classes? The only way to 
> generate peer 
> classes is thro' build.xml, that is available in Turbine
>    1. I guess, I will also have to write MapBuilder class similar to 
> TurbineMapBuilder.
>    2. How does, map builder figures out about usage of 
> database SEQUENCE or 
> AUTO INCREMENT columns
> else:
>    0. Is only Village API sufficient for handling all the 
> database operations?
>    1. I guess, figuring out SEQUENCE or AUTO INCREMENT is not 
> possible 
> thro' Village API
> 
> Thanks.
> 
> -Atul
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org