You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Gareth Coltman <ga...@majorband.co.uk> on 2001/04/17 16:06:15 UTC

Making flux use Oracle sequences

Hi,

I have set up Turbine to connect to an Oracle 8i dbase - fine! Lovely. I
downloaded the SQL to get the Turbine tables generated and using sequences
rather that the ID-Broker. Once again - lovely.

Problem is that the flux mapbuilder classes seem to automatically use the
ID-Broker. So writing to the ACL cause a null pointer exception. Is the only
way for me to fix this to get the flux mapbuilder source and modify it to
use sequences by default?

Thanks.

Gareth



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


Re: AGH! Oracle is painful

Posted by Jason van Zyl <jv...@apache.org>.
Jon Stevens wrote:
> 
> on 4/20/01 6:06 AM, "Jason van Zyl" <jv...@apache.org> wrote:
> 
> > It is probably worth fixing up the JDBC->XML task then, it is not
> > fully integrated with the rest of the torque setup. It would be of
> > great use to have this functionality back. I didn't keep it updated
> > when I initially merged the two existing versions of torque, and
> > it subsequently has not been kept up-to-date WRT to schema changes
> > in torque.
> >
> > If you send me questions in private I can answer any questions if you
> > want to try and get it running, but I don't have time in the next
> > while to get it working completely.
> 
> No, it isn't. The JDBC->XML task will fail miserably with some
> databases...like MySQL...it is much better to parse the output of a .sql
> file than it is to try to get the information from JDBC.

Well, we should have both methods because I completely disagree about
the ease of parsing SQL. And I've had the JDBC->XML work fine in
lots of cases. Both tasks should work and people can use what
is suitable for the job.

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

-- 
jvz.

Jason van Zyl
jvanzyl@apache.org

http://jakarta.apache.org/velocity
http://jakarta.apache.org/turbine
http://jakarta.apache.org/commons
http://tambora.zenplex.org

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


Re: AGH! Oracle is painful

Posted by Jon Stevens <jo...@latchkey.com>.
on 4/20/01 6:06 AM, "Jason van Zyl" <jv...@apache.org> wrote:

> It is probably worth fixing up the JDBC->XML task then, it is not
> fully integrated with the rest of the torque setup. It would be of
> great use to have this functionality back. I didn't keep it updated
> when I initially merged the two existing versions of torque, and
> it subsequently has not been kept up-to-date WRT to schema changes
> in torque.
> 
> If you send me questions in private I can answer any questions if you
> want to try and get it running, but I don't have time in the next
> while to get it working completely.

No, it isn't. The JDBC->XML task will fail miserably with some
databases...like MySQL...it is much better to parse the output of a .sql
file than it is to try to get the information from JDBC.

-jon


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


Re: AGH! Oracle is painful

Posted by Jason van Zyl <jv...@apache.org>.
Gareth Coltman wrote:
> 
> > I just fixed it in CVS so that it works. It is not at all forgiving
> > with the SQL you throw at it but it might take you part of the way.
> > I tried three sql files and only the simplest one worked.
> 
> I have an up-to-date CVS Jakarta-turbine module, but I still get the same
> error. Maybe I'm not copying the right jar's into my TDK. (See my other
> email)
> 
> > What might work better for you is the JDBC -> XML process. I looked
> > at the code a couple minutes ago and I don't think it will work
> > in its current state. You might want to try and fix that up and
> > use that though it's probably not up-to-date WRT the XML schema
> > it produces. It's on my list to fix but it's way at the bottom. If
> > you're desperate I will take a look at it tonight.
> 
> I've never heard of this before. It sounds great. I am trying to produce a
> schema for aan Oracle database with over 20 tables. PLEASE don't make me do
> it by hand. ;)

It is probably worth fixing up the JDBC->XML task then, it is not
fully integrated with the rest of the torque setup. It would be of
great use to have this functionality back. I didn't keep it updated
when I initially merged the two existing versions of torque, and 
it subsequently has not been kept up-to-date WRT to schema changes
in torque.

If you send me questions in private I can answer any questions if you
want to try and get it running, but I don't have time in the next
while to get it working completely.

> 
> Thanks for your help.
> 
> Gareth
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org

-- 
jvz.

Jason van Zyl
jvanzyl@apache.org

http://jakarta.apache.org/velocity
http://jakarta.apache.org/turbine
http://jakarta.apache.org/commons
http://tambora.zenplex.org

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


Re: AGH! Oracle is painful

Posted by Jon Stevens <jo...@latchkey.com>.
on 4/20/01 10:30 AM, "Jason van Zyl" <jv...@apache.org> wrote:

> Why would you not recommend the JDBC->XML process? You just say
> no, without qualification?

Simple:

MySQL does not internally keep the data about relationships between tables.
There is no foreign key information so your output in XML will be totally
missing that piece. The .sql file isn't much better, but at least you have a
place to define it with copy/paste instead of having to do that with the
.xml file after the fact.

-jon


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


RE: AGH! Oracle is painful

Posted by Howard Lin <hl...@vonage.com>.
Well, I managed to make SQL2XML working with Oracle scripts. I use TOAD to
generate the Table Create script.
Here are what I found out:
1) should not have CONSTRAINT in the script
2) should not have TABLESACE, STORAGE, PCTFREE etc.
3) should use ; instead of /
5) must have primaryKey otherwise you will get a "comboPK undefined" error
when compiling generated Java file due to a bug in Object.vm (I submitted a
fix)

Check torque.xml for how to add sql-xml taskdefs. You can also test your
script by typing

"java -cp ..\lib\turbine-2.1-dev-unreleased.jar
org.apache.turbine.torque.engine.database.transform.SQLToAppData script.sql"

Howard

-----Original Message-----
From: Gareth Coltman [mailto:gareth_coltman@majorband.co.uk]
Sent: Tuesday, April 24, 2001 4:14 AM
To: turbine-dev@jakarta.apache.org
Subject: RE: AGH! Oracle is painful


> > The SQL->XML doesn't
> > > work very well at all. I could only get it to work with a very small
> > > number of SQL files I tried. I tried scarabs sql schema and it just
> > > hangs there. I don't think that parser would work very well on
> > > nasty Oracle SQL either.
> >

Hmm. Well, for me it doesn't work at all..

I have the latest build of the turbine.jar. I have copied it into my apps
lib directory. Upon running the task like this:

build-project sql2xml

I get:

BUILD FAILED

C:\tdk\webapps\devsite\WEB-INF\build\build-project.xml:442: Could not create
task of type: sql-xml. Common solutions are to use taskdef to declare your
task, or, if this is an optional task, to put the optional.jar in the lib
directory of your ant installation (ANT_HOME).

This is running on a W2K machine. I will happily test SQL->XML (and happily
fix it if it doesn't work on nasty Oracle sql..!) if I can get it top work.

Gareth



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



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


RE: AGH! Oracle is painful

Posted by Gareth Coltman <ga...@majorband.co.uk>.
> > The SQL->XML doesn't
> > > work very well at all. I could only get it to work with a very small
> > > number of SQL files I tried. I tried scarabs sql schema and it just
> > > hangs there. I don't think that parser would work very well on
> > > nasty Oracle SQL either.
> >

Hmm. Well, for me it doesn't work at all..

I have the latest build of the turbine.jar. I have copied it into my apps
lib directory. Upon running the task like this:

build-project sql2xml

I get:

BUILD FAILED

C:\tdk\webapps\devsite\WEB-INF\build\build-project.xml:442: Could not create
task of type: sql-xml. Common solutions are to use taskdef to declare your
task, or, if this is an optional task, to put the optional.jar in the lib
directory of your ant installation (ANT_HOME).

This is running on a W2K machine. I will happily test SQL->XML (and happily
fix it if it doesn't work on nasty Oracle sql..!) if I can get it top work.

Gareth



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


Re: AGH! Oracle is painful

Posted by Jon Stevens <jo...@latchkey.com>.
on 4/20/01 11:03 AM, "Jason van Zyl" <jv...@apache.org> wrote:

> I know, I know, I said I would make a better parser a while back,
> I'm a lazy bum :-)

I think you are anything but lazy...:-)

-jon


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


Re: AGH! Oracle is painful

Posted by Jason van Zyl <jv...@apache.org>.
Jon Stevens wrote:
> 
> on 4/20/01 10:30 AM, "Jason van Zyl" <jv...@apache.org> wrote:
> 
> > The SQL->XML doesn't
> > work very well at all. I could only get it to work with a very small
> > number of SQL files I tried. I tried scarabs sql schema and it just
> > hangs there. I don't think that parser would work very well on
> > nasty Oracle SQL either.
> 
> Well, then we should fix it. I spent a lot of time re-writing it to work
> better with regards to bad .sql files and I'm sure there are still a few
> bugs in it, but I know that I got it to parse one hell of a huge .sql file
> that Helm was using...
> 
> Also, Jason, Town has a .sql parser done in javacc, maybe you can take that
> and create a better system...:-)

I know, I know, I said I would make a better parser a while back,
I'm a lazy bum :-)

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

-- 
jvz.

Jason van Zyl
jvanzyl@apache.org

http://jakarta.apache.org/velocity
http://jakarta.apache.org/turbine
http://jakarta.apache.org/commons
http://tambora.zenplex.org

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


Re: AGH! Oracle is painful

Posted by Jon Stevens <jo...@latchkey.com>.
on 4/20/01 10:30 AM, "Jason van Zyl" <jv...@apache.org> wrote:

> The SQL->XML doesn't
> work very well at all. I could only get it to work with a very small
> number of SQL files I tried. I tried scarabs sql schema and it just
> hangs there. I don't think that parser would work very well on
> nasty Oracle SQL either.

Well, then we should fix it. I spent a lot of time re-writing it to work
better with regards to bad .sql files and I'm sure there are still a few
bugs in it, but I know that I got it to parse one hell of a huge .sql file
that Helm was using...

Also, Jason, Town has a .sql parser done in javacc, maybe you can take that
and create a better system...:-)

-jon


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


Re: AGH! Oracle is painful

Posted by Jason van Zyl <jv...@apache.org>.
Jon Stevens wrote:
> 
> on 4/20/01 3:46 AM, "Gareth Coltman" <ga...@majorband.co.uk> wrote:
> 
> >> What might work better for you is the JDBC -> XML process. I looked
> >> at the code a couple minutes ago and I don't think it will work
> >> in its current state. You might want to try and fix that up and
> >> use that though it's probably not up-to-date WRT the XML schema
> >> it produces. It's on my list to fix but it's way at the bottom. If
> >> you're desperate I will take a look at it tonight.
> >
> > I've never heard of this before. It sounds great. I am trying to produce a
> > schema for aan Oracle database with over 20 tables. PLEASE don't make me do
> > it by hand. ;)
> >
> > Thanks for your help.
> >
> > Gareth
> 
> No. Do not use the JDBC->XML process. Use the .sql->XML process. It works
> pretty well.

Why would you not recommend the JDBC->XML process? You just say
no, without qualification? I've always recommended the JDBC->XML
method because while not perfect it did generally work very well
because the proces is much simpler than trying to parse SQL. Trying
to parse all forms of SQL, especially with hand-written parser, is
a nightmare. If everything was SQL92 then maybe, but that's not
even close to true. At least with metadata there is some uniformity.

The SQL->XML doesn't
work very well at all. I could only get it to work with a very small
number of SQL files I tried. I tried scarabs sql schema and it just
hangs there. I don't think that parser would work very well on
nasty Oracle SQL either.

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

-- 
jvz.

Jason van Zyl
jvanzyl@apache.org

http://jakarta.apache.org/velocity
http://jakarta.apache.org/turbine
http://jakarta.apache.org/commons
http://tambora.zenplex.org

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


Re: AGH! Oracle is painful

Posted by Jon Stevens <jo...@latchkey.com>.
on 4/20/01 3:46 AM, "Gareth Coltman" <ga...@majorband.co.uk> wrote:

>> What might work better for you is the JDBC -> XML process. I looked
>> at the code a couple minutes ago and I don't think it will work
>> in its current state. You might want to try and fix that up and
>> use that though it's probably not up-to-date WRT the XML schema
>> it produces. It's on my list to fix but it's way at the bottom. If
>> you're desperate I will take a look at it tonight.
> 
> I've never heard of this before. It sounds great. I am trying to produce a
> schema for aan Oracle database with over 20 tables. PLEASE don't make me do
> it by hand. ;)
> 
> Thanks for your help.
> 
> Gareth

No. Do not use the JDBC->XML process. Use the .sql->XML process. It works
pretty well.

-jon


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


RE: AGH! Oracle is painful

Posted by Gareth Coltman <ga...@majorband.co.uk>.
> I just fixed it in CVS so that it works. It is not at all forgiving
> with the SQL you throw at it but it might take you part of the way.
> I tried three sql files and only the simplest one worked.

I have an up-to-date CVS Jakarta-turbine module, but I still get the same
error. Maybe I'm not copying the right jar's into my TDK. (See my other
email)

> What might work better for you is the JDBC -> XML process. I looked
> at the code a couple minutes ago and I don't think it will work
> in its current state. You might want to try and fix that up and
> use that though it's probably not up-to-date WRT the XML schema
> it produces. It's on my list to fix but it's way at the bottom. If
> you're desperate I will take a look at it tonight.

I've never heard of this before. It sounds great. I am trying to produce a
schema for aan Oracle database with over 20 tables. PLEASE don't make me do
it by hand. ;)

Thanks for your help.

Gareth


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


Re: AGH! Oracle is painful

Posted by Jason van Zyl <jv...@apache.org>.
Gareth Coltman wrote:
> 
> Good morning all(in the UK anyway).
> 
> Can someone tell me if it is normal for turbine to try and insert NULL into
> the primary key. Is this what happens using auto increment? I will continue
> to investigate but so far I cam completely unable to get Turbine to generate
> any kind of primary key. I can happily insert my own keys so the connection
> is fine...
> 
> More importantly is why the sql2xml task doesn't work. I have tried to run
> it on a W2K machine and get the following error:

I just fixed it in CVS so that it works. It is not at all forgiving
with the SQL you throw at it but it might take you part of the way.
I tried three sql files and only the simplest one worked.

What might work better for you is the JDBC -> XML process. I looked
at the code a couple minutes ago and I don't think it will work
in its current state. You might want to try and fix that up and
use that though it's probably not up-to-date WRT the XML schema
it produces. It's on my list to fix but it's way at the bottom. If
you're desperate I will take a look at it tonight.

> 
> build-project.xml:442: Could not create task of type: sql-xml. Common
> solutions are to use taskdef to declare your task, or, if this is an
> optional task, to put the optional.jar in the lib directory of your ant
> installation (ANT_HOME).
> 
> This is really important,as otherwise I am going to have to create the
> entire schema by hand.

You'll have to pull turbine out of CVS and build it if you want the
fixed
sql2xml ant task. It will be in the next TDK.
 
> Gareth
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org

-- 
jvz.

Jason van Zyl
jvanzyl@apache.org

http://jakarta.apache.org/velocity
http://jakarta.apache.org/turbine
http://jakarta.apache.org/commons
http://tambora.zenplex.org

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


RE: AGH! Oracle is painful

Posted by Gareth Coltman <ga...@majorband.co.uk>.
Good morning all(in the UK anyway).

Can someone tell me if it is normal for turbine to try and insert NULL into
the primary key. Is this what happens using auto increment? I will continue
to investigate but so far I cam completely unable to get Turbine to generate
any kind of primary key. I can happily insert my own keys so the connection
is fine...

More importantly is why the sql2xml task doesn't work. I have tried to run
it on a W2K machine and get the following error:

build-project.xml:442: Could not create task of type: sql-xml. Common
solutions are to use taskdef to declare your task, or, if this is an
optional task, to put the optional.jar in the lib directory of your ant
installation (ANT_HOME).

This is really important,as otherwise I am going to have to create the
entire schema by hand.

Gareth



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


AW: AGH! Oracle is painful

Posted by Holger Dehnhardt <de...@hw-edv.de>.
> 
> on 4/18/01 6:36 AM, "Gareth Coltman" 
> <ga...@majorband.co.uk> wrote:
> 
> > Man, this was soooo much easier with MySQL....
> 
> Just think...you paid a shit load of money for that pain. :-)
> 
> -jon
> 
Not even pain is for free ;-)

Holger 


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


Re: AGH! Oracle is painful

Posted by Jon Stevens <jo...@latchkey.com>.
on 4/18/01 6:36 AM, "Gareth Coltman" <ga...@majorband.co.uk> wrote:

> Man, this was soooo much easier with MySQL....

Just think...you paid a shit load of money for that pain. :-)

-jon


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


AGH! Oracle is painful

Posted by Gareth Coltman <ga...@majorband.co.uk>.
Hello all,

Thanks for all your help thus far. I am struggling to get Turbine to write
any data to the oracle database.

I have create a peer for my database table by hand:

- <database>
- <table name="T_PROPERTIES" idMethod="none">
  <column name="ID" autoIncrement="true" required="true" primaryKey="true"
type="INTEGER" />
  <column name="NAME" size="100" type="VARCHAR" />
  <column name="POSTCODE" size="8" type="VARCHAR" />
  </table>
  </database>

It would be great if I could configure the build script to connect to oracle
and query my database and create my schemas for me. I guess I could output a
SQL create script and convert that to XML... Anyway.

Upon trying to use the save method I get the following warning:

"IDBroker is being used with db: default
 which does not support transactions.  It is possible to
 generate duplicate keys, if multiple JVM's are used or other
 means are used to write to the database."

(Where was I supposed to inform the ID broker to user Oracle?)

Then I get a null pointer exception.

Apparently the TDK has been tested with Oracle(?). I would prefer to use
sequences as I said but am happy to use the IDBROKER if this will make my
life much easier. At the moment I can't do any kind of update.

I have debugged it and found that it is failing in the Save method in the
BaseObject class:

BasePeer.beginTransaction(TPropertiesPeer.getMapBuilder().getDatabaseMap().g
etName());

produces a null value and thus an exception...

Man, this was soooo much easier with MySQL....

Cheers,

Gareth


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


Re: Making flux use Oracle sequences

Posted by "Frank W. Nolden" <fr...@maxware.nl>.
I dont' exactly know what your problem is, but it sounds to me that you are
having problems geting the autoincrement to work with Oracle. Try the
following:

- <table name="CIF" idMethod="autoincrement">
  <column name="CIF_ID" required="true" autoIncrement="true"
primaryKey="true" type="BIGINT" />
  <column name="CIF_Name" required="true" size="50" type="VARCHAR" />
  <column name="CIF_Creation_Date" required="true" type="TIMESTAMP" />
  <column name="CIF_Created_By" required="true" size="50" type="VARCHAR" />
  <column name="CIF_Modification_Date" required="false" type="TIMESTAMP" />
  <column name="CIF_Modified_By" required="false" size="50" type="VARCHAR"
/>
  <column name="CIF_Deletion_Date" required="false" type="TIMESTAMP" />
  <column name="CIF_Deleted_By" required="false" size="50" type="VARCHAR" />
  <column name="CIF_Type" required="true" size="50" type="VARCHAR" />
  <column name="CIF_Description" required="false" size="255" type="VARCHAR"
/>
  <column name="CIF_Short_Name" required="false" size="50" type="VARCHAR" />
  <column name="CIF_Hash" required="true" size="32" type="VARCHAR" />
  </table>

Add the idMethod to the table definition. Maybe that solves your problem.
Regards,

Frank

----- Original Message -----
From: Gareth Coltman
To: turbine-dev@jakarta.apache.org
Sent: Wednesday, April 18, 2001 18:04
Subject: RE: Making flux use Oracle sequences


To summarise the trials of Oracle....

For some reason (???) the ID_BROKER doesn't generate primary keys when using
Oracle. I have had great success using MySQL. I am sure that it has nothing
to do with the connection as I can insert records manually. Something to do
with the generated tables?????

The error is that Turbine has tried to insert NULL into the PK.

My efforts to use sequences :

        tMap.setPrimaryKeyMethod(TableMap.SEQUENCE);

        tMap.setPrimaryKeyMethodInfo("s_properties");

        tMap.setSequenceInfo("s_properties");


tMap.addPrimaryKey ( getProperty_Id(), new Integer(0) );

(absolutely no idea if that is right - s_properties is the name of my
sequence)

Resulted in exactly the same error.

If someone has successfully used ANY auto PK generation with an Oracle
database (either with the Turbine tables or Application tables) PLEASE let
me know.

A desperate man.....

Gareth


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


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


RE: Making flux use Oracle sequences

Posted by Gareth Coltman <ga...@majorband.co.uk>.
To summarise the trials of Oracle....

For some reason (???) the ID_BROKER doesn't generate primary keys when using
Oracle. I have had great success using MySQL. I am sure that it has nothing
to do with the connection as I can insert records manually. Something to do
with the generated tables?????

The error is that Turbine has tried to insert NULL into the PK.

My efforts to use sequences :

        tMap.setPrimaryKeyMethod(TableMap.SEQUENCE);

        tMap.setPrimaryKeyMethodInfo("s_properties");

        tMap.setSequenceInfo("s_properties");


	tMap.addPrimaryKey ( getProperty_Id(), new Integer(0) );

(absolutely no idea if that is right - s_properties is the name of my
sequence)

Resulted in exactly the same error.

If someone has successfully used ANY auto PK generation with an Oracle
database (either with the Turbine tables or Application tables) PLEASE let
me know.

A desperate man.....

Gareth


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


Re: Making flux use Oracle sequences

Posted by Rafal Krzewski <ra...@apache.org>.
Sean Legassick wrote:

> You might want to argue that util.db.map is a funny place to find the
> mapbuilder for security tables - I'm not sure I'd want to disagree :-)

Yup. That is a pretty weird place for that. Note that the map builder
contains also a map for the Scheduler Service. We really need to
auto-generate
that stuff and put it into the correct place.
 
> But you're guess is off, all the tables are set up as type
> IDBROKERTABLE...

You could try switchnig the primary key methods after the map after the
map is built... for example extend TurbineMapBuilder class, call 
super.build() (or whatever, I don't care enough to check) and then call
setPrimaryKeyMethod() on the tables... It's a sort of a hack, but I
guess it's all you can do, until we have the system Torque-generated
(then you could modify the core-schema.xml, and regeneratete the
classes)

Hmm... still it's not very good - you shouldn't need recompile Turbine
to configure your app. Maybe the map builder should read the primary
key method from TR.props? What do you think?

Rafal

--
Turbine Project  -  State of the Art in
development of applications for the Web
>  http://jakarta.apache.org/turbine  <

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


Re: Making flux use Oracle sequences

Posted by Sean Legassick <se...@informage.net>.
In message 
<PL...@majorband.co.uk>, Gareth 
Coltman <ga...@majorband.co.uk> writes
>I can't find the MapBuilder source for Turbine User peers anywhere in CVS.

org.apache.turbine.util.db.map.TurbineMapBuilder

>Am I being stupid?

You might want to argue that util.db.map is a funny place to find the 
mapbuilder for security tables - I'm not sure I'd want to disagree :-)

But you're guess is off, all the tables are set up as type 
IDBROKERTABLE...

-- 
Sean Legassick
sean@informage.net
         Je suis un homme: rien d'humain en m'est étranger

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


RE: Making flux use Oracle sequences

Posted by Gareth Coltman <ga...@majorband.co.uk>.
I can't find the MapBuilder source for Turbine User peers anywhere in CVS.
Am I being stupid?

Gareth


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


RE: Making flux use Oracle sequences

Posted by Gareth Coltman <ga...@majorband.co.uk>.
OK... Here's what I think it is....
(total guess - dont bite my head off)

In the MapBuilder class that is generated by Torque for your own project
there is the following line:

	tMap.setPrimaryKeyMethod(TableMap.IDBROKERTABLE);

This can be used to set what method is used to generate p keys.

I think that the Turbine Security Map Builder (which I think it embedded in
the JAR file) has AUTO_INCREMENT as the p ket method by default (because
this is the MYSQL method of primary key generation).

I need to get hold of the source for the tdk and have a look.

Gareth


>
> Hi Gareth,
>
> I had the same problem with inserting users into Turbine (although nobody
> else seem to run into it).  Jason suggested that I look at flux,
> but I have
> been buried under other stuff - I'll figure (and hopefully fix) it out
> eventually.
>
> Try inserting into another table to check that your IDBroker is
> working.  In
> the mean time you can do what I do - manually call IDBroker and
> set the user
> primary key.  I know it is the worse of the worst of hacks, but it saves
> time :-)
>



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


Re: Making flux use Oracle sequences

Posted by Leon Messerschmidt <le...@opticode.co.za>.
Hi Gareth,

I had the same problem with inserting users into Turbine (although nobody
else seem to run into it).  Jason suggested that I look at flux, but I have
been buried under other stuff - I'll figure (and hopefully fix) it out
eventually.

Try inserting into another table to check that your IDBroker is working.  In
the mean time you can do what I do - manually call IDBroker and set the user
primary key.  I know it is the worse of the worst of hacks, but it saves
time :-)

~ Leon

> Jon,
>
> Thanks for your feedback. I am happy to use IDBROKER, but I can't even get
> that to work. I'm sure I have set up the tables properly, but when I try
to
> insert something into the Turbine_Users table, it tries to insert a NULL
> value into the ID field. Oracle won't allow this of course. It seems to me
> that it is still trying to use the AUTO_INCREMENT functionality of MySQL,
> not the IDBROKER.
>
> Any clues? :)
>
> Gareth




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


RE: Making flux use Oracle sequences

Posted by Gareth Coltman <ga...@majorband.co.uk>.
Jon,

Thanks for your feedback. I am happy to use IDBROKER, but I can't even get
that to work. I'm sure I have set up the tables properly, but when I try to
insert something into the Turbine_Users table, it tries to insert a NULL
value into the ID field. Oracle won't allow this of course. It seems to me
that it is still trying to use the AUTO_INCREMENT functionality of MySQL,
not the IDBROKER.

Any clues? :)

Gareth


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


Re: Making flux use Oracle sequences

Posted by John McNally <jm...@collab.net>.
Well, the IDBroker has obviously not been used as much as Oracle
sequences.  It has been used more often than the code in Turbine related
to Oracle sequences.  Sequences are probably highly optimized, but the
IDBroker provides for maintaining a store of available ids in memory to
reduce calls to the db.

The standard method of using sequences with the Peer system is to call
the sequence to get an id and then use that when inserting into a
table.  If you use a trigger to create the id from a sequence during the
insert, you will lose some functionality from the om-peer layer as an OM
object has no way of retrieving its new id after being saved.  That said
simple usage of om-peer layer is still possible and has been used this
way.  And maybe some pl/sql guru out there knows some way to retrieve
the triggered sequence id, so that it could be used in a auto-increment
type of implementation?

John McNally

Gareth Coltman wrote:
> 
> I wanted to clarify a bit.
> 
> I am trying to use sequences in the belief that they are probably more
> robust (tried and tested) than the ID_Broker. If somebody wants to tell me
> that I'm wrong (I hear Jon Stevens  coming as we speak) then I will be more
> than happy to use the ID_BROKER.
> 
> > I have set up Turbine to connect to an Oracle 8i dbase - fine! Lovely. I
> > downloaded the SQL to get the Turbine tables generated and using sequences
> > rather that the ID-Broker. Once again - lovely.
> >
> > Problem is that the flux mapbuilder classes seem to automatically use the
> > ID-Broker. So writing to the ACL cause a null pointer exception.
> > Is the only
> > way for me to fix this to get the flux mapbuilder source and modify it to
> > use sequences by default?
> >
> > Thanks.
> >
> > Gareth
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org

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


RE: Making flux use Oracle sequences

Posted by Gareth Coltman <ga...@majorband.co.uk>.
I wanted to clarify a bit.

I am trying to use sequences in the belief that they are probably more
robust (tried and tested) than the ID_Broker. If somebody wants to tell me
that I'm wrong (I hear Jon Stevens  coming as we speak) then I will be more
than happy to use the ID_BROKER.

> I have set up Turbine to connect to an Oracle 8i dbase - fine! Lovely. I
> downloaded the SQL to get the Turbine tables generated and using sequences
> rather that the ID-Broker. Once again - lovely.
>
> Problem is that the flux mapbuilder classes seem to automatically use the
> ID-Broker. So writing to the ACL cause a null pointer exception.
> Is the only
> way for me to fix this to get the flux mapbuilder source and modify it to
> use sequences by default?
>
> Thanks.
>
> Gareth
>



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