Hi Nilesh,

    <class-descriptor
> >class="com.haystack.emailmarketingchoice.member.MemberVO"
> >table="tblMember">
> >
> >        <field-descriptor id="1" name="memberId" column="member_id"
> >jdbc-type="BIGINT"  primarykey="true" autoincrement="true"
> >access="readonly" />
> >         ------------
> >         ------------
> >     </class-descriptor>

As Glenn said your mapping looks fine. There is a test case in OJB test suite called ....broker.sequence.NativeIdentifierTest. This test is valid for Hsql and MySQL. I don't use MySQL personally, but some other developer use it and test seems to pass.
Only problem I know about is with old versions of MySQL, seems they don't support the used query to get the last inserted id (in that case you have to patch the PlatformMySQLImpl class).


>>>I am using MySQL in which I have also used the auto-increment constraint
>>>for the Primarykey ( bigint(20) )


I don't know the best setting for "member_id" column, but shouldn't it be NATIVE_ID int(20) or something else instead bigint(20) (sorry if I tell nonsense)?

regards,
Armin

Nilesh wrote:


Thanks Glenn,
                     Yes I am using OJB rc6. And I have also tried without
using any sequence manager. Do I neeed to create my own sequence manager.
How will it help and how do I do that ? Please tell me if you have any idea.

Thanks again.


Regards, Nilesh.






----- Original Message ----- From: "Glenn Barnard" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, April 23, 2004 8:56 PM Subject: RE: auto increment not working



Your settings look good. I use this technique with MS SQL Server and all

is


working well. Please note which version of OJB you're using. Hopefully,

its


rc6!


From: "Nilesh" <[EMAIL PROTECTED]>
Reply-To: "OJB Users List" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
CC: <[EMAIL PROTECTED]>
Subject: auto increment not working
Date: Sun, 22 Feb 2004 19:40:34 +0530

In my OJB (using  PersistenceBroker ) application auto-increment is not
working.

I am using  MySQL in which I have also used the auto-increment constraint
for the Primarykey ( bigint(20) )


For my database definition i have used the "SequenceManagerNativeImpl"


<sequence-manager

className="org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl">


           <attribute attribute-name="autoNaming"
attribute-value="true"/>
</sequence-manager>


also in the mapping file i have


   <class-descriptor
class="com.haystack.emailmarketingchoice.member.MemberVO"
table="tblMember">

      <field-descriptor id="1" name="memberId" column="member_id"
jdbc-type="BIGINT"  primarykey="true" autoincrement="true"
access="readonly" />
       ------------
       ------------
   </class-descriptor>

i have also tried without the --> access="readonly"

but it generates a new 20 digit  "auto-increment" number  only for the
first insert, for the subsequent inserts it generates the same number and

a


Duplicate Entry error arises.

I have also tried the following sequence managers

SequenceManagerMySQLImpl
SequenceManagerSeqHiLoImpl

with and without these attributes
 <attribute attribute-name="grabSize" attribute-value="5" />
 <attribute attribute-name="globalSequenceId" attribute-value="true"/>
<attribute attribute-name="globalSequenceStart"

attribute-value="10000"/>




But ALL Failed.
Have any one of you tried this. Please let me know.
Thanks in advance for your interest in my problem.

Regards,
Arjun.







_________________________________________________________________ From must-see cities to the best beaches, plan a getaway with the Spring Travel Guide! http://special.msn.com/local/springtravel.armx


--------------------------------------------------------------------- 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]




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



Reply via email to