RE: Identity_Insert mssql

2003-06-06 Thread Shannon Ewing
We are currently using one of the first iterations of RC3 and have used OJB
since the .9x days. One of the DB we support is MS SQL which uses Identity
fields for keys (I know it's bad but it's legacy stuff). We previously had
to do a hack as Peter mentioned to not pass the auto-increment field in the
SQL on inserts (specifically,
org.apache.ojb.broker.accesslayer.StatementManager.bindInsert and
org.apache.ojb.broker.accesslayer.sql.SqlInsertStatement.appendListOfColumns
and appendListOfValues). Needless to say, it was a pain to keep these
updated as OJB changed. 

A fellow OJB user was having the same issue we were and noted that, at least
in RC3, you can set a column to be "read-only" in the descriptor and it
would not send that field on the insert/update statements. We finally got
around to try this and IT WORKED! We finally can dump our hack and use
normal OJB as distributed. Below is an example that works for us with
identity fields:



On a side note, you may want to also implement a "do nothing" sequence
generator since the database is generating the sequence. We found that with
all the sequence generators that are supplied with OJB, they make calls to
the DB to get ranges for the sequence generation. This is not necessary when
the db itself is generating the sequence and really cuts down the overhead
allot.

-Original Message-
From: Peter Costa [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 11:13 PM
To: OJB Users List
Subject: RE: Identity_Insert mssql


We were not able to fix it. We had to modify the OJB code to check to
see if the first field is an auto-increment field and if it was, then we
would turn Identity insert on. That requires that you make sure that if
you are going to use Identity insert that it be the first field. Not a
great fix, but it seems to be working right now. It is a hack, but we
don't have time to deal with it. Hope this helps.
 
Peter

-Original Message- 
From: Brian Chaplin [mailto:[EMAIL PROTECTED] 
Sent: Thu 6/5/2003 9:52 PM 
To: [EMAIL PROTECTED] 
Cc: 
    Subject: Re: Identity_Insert mssql



Did you ever solve this?  I'm having the same issue with Sybase
11.9.3
identity columns.
"Peter Costa" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am stuck with it for right now. So I take it there is no
easy way
> around this other than removing the Identities. If anyone has
any
> suggestions it would be much appreciated. I am pretty much
stuck right
> now.
>
> Thank you.
>
> Peter
>
> -Original Message-
> From: Ryan Vanderwerf [mailto:[EMAIL PROTECTED]
> Sent: Wed 4/9/2003 5:27 PM
> To: OJB Users List
> Cc:
> Subject: RE: Identity_Insert mssql
>
>
>
> Personally I'd remove use of identities where you can, and use
> the
> SequenceManangerStoredProcedureImpl class, it will use a
stored
> procedure instead which is multi-app server safe (and tested
on
> mssql).
> It's in current cvs, I'm guessing it will be in next rc3
> release. That
> identity stuff isn't worth it, if you are stuck with them then
> my
> condolences ;)
>
> Ryan
>
> -Original Message-
> From: Peter Costa [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 09, 2003 3:51 PM
> To: [EMAIL PROTECTED]
> Subject: Identity_Insert mssql
>
> We are using OJB and mssql. We are having problems with tables
> that have
> an identity field on the which allows for auto-incrementing. I
> have been
> told that it was fixed in 1.0, but when we tried it we still
had
> issues.
> Does anyone know about this issue? Do I need to change
something
> in one
> of the xml files? Any help would be appreciated. Thank you.
>
> Peter
>
>
>
>
-
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





+-+ 
This message may contain confidential and/or privileged information.  If you
are no

RE: Identity_Insert mssql

2003-06-05 Thread Peter Costa
We were not able to fix it. We had to modify the OJB code to check to
see if the first field is an auto-increment field and if it was, then we
would turn Identity insert on. That requires that you make sure that if
you are going to use Identity insert that it be the first field. Not a
great fix, but it seems to be working right now. It is a hack, but we
don't have time to deal with it. Hope this helps.
 
Peter

-Original Message- 
From: Brian Chaplin [mailto:[EMAIL PROTECTED] 
Sent: Thu 6/5/2003 9:52 PM 
To: [EMAIL PROTECTED] 
Cc: 
Subject: Re: Identity_Insert mssql



Did you ever solve this?  I'm having the same issue with Sybase
11.9.3
identity columns.
"Peter Costa" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am stuck with it for right now. So I take it there is no
easy way
> around this other than removing the Identities. If anyone has
any
> suggestions it would be much appreciated. I am pretty much
stuck right
> now.
>
> Thank you.
>
> Peter
>
> -Original Message-
> From: Ryan Vanderwerf [mailto:[EMAIL PROTECTED]
> Sent: Wed 4/9/2003 5:27 PM
> To: OJB Users List
> Cc:
> Subject: RE: Identity_Insert mssql
>
>
>
> Personally I'd remove use of identities where you can, and use
> the
> SequenceManangerStoredProcedureImpl class, it will use a
stored
> procedure instead which is multi-app server safe (and tested
on
> mssql).
> It's in current cvs, I'm guessing it will be in next rc3
> release. That
> identity stuff isn't worth it, if you are stuck with them then
> my
> condolences ;)
>
> Ryan
>
> -Original Message-
> From: Peter Costa [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 09, 2003 3:51 PM
> To: [EMAIL PROTECTED]
> Subject: Identity_Insert mssql
>
> We are using OJB and mssql. We are having problems with tables
> that have
> an identity field on the which allows for auto-incrementing. I
> have been
> told that it was fixed in 1.0, but when we tried it we still
had
> issues.
> Does anyone know about this issue? Do I need to change
something
> in one
> of the xml files? Any help would be appreciated. Thank you.
>
> Peter
>
>
>
>
-
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





Re: Identity_Insert mssql

2003-06-05 Thread Brian Chaplin
Did you ever solve this?  I'm having the same issue with Sybase 11.9.3
identity columns.
"Peter Costa" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am stuck with it for right now. So I take it there is no easy way
> around this other than removing the Identities. If anyone has any
> suggestions it would be much appreciated. I am pretty much stuck right
> now.
>
> Thank you.
>
> Peter
>
> -Original Message-
> From: Ryan Vanderwerf [mailto:[EMAIL PROTECTED]
> Sent: Wed 4/9/2003 5:27 PM
> To: OJB Users List
> Cc:
> Subject: RE: Identity_Insert mssql
>
>
>
> Personally I'd remove use of identities where you can, and use
> the
> SequenceManangerStoredProcedureImpl class, it will use a stored
> procedure instead which is multi-app server safe (and tested on
> mssql).
> It's in current cvs, I'm guessing it will be in next rc3
> release. That
> identity stuff isn't worth it, if you are stuck with them then
> my
> condolences ;)
>
> Ryan
>
> -Original Message-
> From: Peter Costa [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 09, 2003 3:51 PM
> To: [EMAIL PROTECTED]
> Subject: Identity_Insert mssql
>
> We are using OJB and mssql. We are having problems with tables
> that have
> an identity field on the which allows for auto-incrementing. I
> have been
> told that it was fixed in 1.0, but when we tried it we still had
> issues.
> Does anyone know about this issue? Do I need to change something
> in one
> of the xml files? Any help would be appreciated. Thank you.
>
> Peter
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]