Do I have to implement a store procedure and create OJB tables like OJB_NEXTVAL_SEQ?
My repository.xml:
....
<sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
<attribute attribute-name="grabSize" attribute-value="20"/>
<attribute attribute-name="globalSequenceId" attribute-value="false"/>
<attribute attribute-name="globalSequenceStart" attribute-value="10000"/>
<attribute attribute-name="autoNaming" attribute-value="true"/>
</sequence-manager>
....
<field-descriptor
id="1"
name="id"
column="CdEmp"
jdbc-type="INTEGER"
primarykey="true"
autoimcrement="true"
nullable="false"/>
....
and my table script on Ms Sql Server 2000:
CREATE TABLE [dbo].[Empresa] ( [CdEmp] [int] IDENTITY (1, 1) NOT NULL , [NmEmp] [varchar] (50) NOT NULL ) ON [PRIMARY]
where CdEmp is Identity and Primary key.
on the code I'm just doing...
Empresa empresa = new Empresa();
empresa.setNome("Company name");
broker.store(empresa);It still continues to update the name of id equals to 0 in the table.
Armin Waibel wrote:
Hi,
Rogerio Tambellini wrote:
I'm using OJB connecting to MsSqlServer, but I'm not able to automatic increment a column into the column. I've added the following line into the repository.xml:please set grabSize > 1, because 1 will eliminate the advantage of this implementation (default was 20).
<sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
<attribute attribute-name="grabSize" attribute-value="1"/> </sequence-manager>
see http://db.apache.org/ojb/sequencemanager.html
Primary key column in the table is set to Auto-Increment, but it's still not working. When I store into the database, "store" operation always updates the 0 id line.hmm, if your field-descriptor looks like
<field-descriptor name="articleId" column="ARTICLE_ID" jdbc-type="INTEGER" primarykey="true" autoincrement="true" />
all should work well.
regards, Armin
Please, anyone has a implentation sample or a tutorial for OJB+MsSqlServer? Or just a hint?
Regards, Rog�rio
--------------------------------------------------------------------- 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]
