You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Luciano Resende <lu...@gmail.com> on 2006/12/20 18:29:54 UTC
[DAS] ApplyChnages fails in a table with generated primary key... and added DO does not include a modified property...
So, i was trying to create a test case for :
Insert with no changed properties to row with generated ID (you could
duplicate the test above with Company since it has a generated ID)
public void testPartialReadInsertApplyWithGeneratedID() throws Exception {
DAS das = DAS.FACTORY.createDAS(getConnection());
// Read some customers
Command select = das.createCommand("Select * from COMPANY");
DataObject root = select.executeQuery();
//Remember count
int count = root.getList("COMPANY").size();
// Create a new customer
root.createDataObject("COMPANY");
// Build apply changes command
das.applyChanges(root);
// verify insert
root = select.executeQuery();
assertEquals(count + 1, root.getList("COMPANY").size());
}
DAS is generating the following SQL :
insert into COMPANY(ID, NAME, EOTMID) values (?, ?, ?)
And it's causing the following exception
SQL Exception: Attempt to modify an identity column 'ID'.
My understanding is that, when IDs are automaticaly generated primary keys,
they should not be part of the INSERT statement.
Before I create a JIRA, I just want to make sure my understanding is right..
--
Luciano Resende
http://people.apache.org/~lresende
Re: [DAS] ApplyChnages fails in a table with generated primary key... and added DO does not include a modified property...
Posted by Luciano Resende <lu...@gmail.com>.
The problem you mentioned I think was already fixed by Brent. My problem was
slightly different, although the DAS was identifying the ID as a primary key
following some convention over configuration, is was not identifying it as a
generated primary key. Using a external configuration file, where the column
was properly defined, fixed the problem I mentioned in my previous e-mail.
--
Luciano Resende
http://people.apache.org/~lresende
On 12/20/06, Adriano Crestani <ad...@gmail.com> wrote:
>
> Maybe it has something to do with ths thread:
> http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg11303.html
>
> Adriano Crestani
>
> On 12/20/06, Luciano Resende <lu...@gmail.com> wrote:
> >
> > So, i was trying to create a test case for :
> >
> > Insert with no changed properties to row with generated ID (you could
> > duplicate the test above with Company since it has a generated ID)
> >
> > public void testPartialReadInsertApplyWithGeneratedID() throws Exception
> {
> >
> > DAS das = DAS.FACTORY.createDAS(getConnection());
> > // Read some customers
> > Command select = das.createCommand("Select * from COMPANY");
> > DataObject root = select.executeQuery();
> >
> > //Remember count
> > int count = root.getList("COMPANY").size();
> >
> > // Create a new customer
> > root.createDataObject("COMPANY");
> >
> > // Build apply changes command
> > das.applyChanges(root);
> >
> > // verify insert
> > root = select.executeQuery();
> > assertEquals(count + 1, root.getList("COMPANY").size());
> >
> > }
> >
> > DAS is generating the following SQL :
> > insert into COMPANY(ID, NAME, EOTMID) values (?, ?, ?)
> >
> > And it's causing the following exception
> > SQL Exception: Attempt to modify an identity column 'ID'.
> >
> > My understanding is that, when IDs are automaticaly generated primary
> > keys,
> > they should not be part of the INSERT statement.
> > Before I create a JIRA, I just want to make sure my understanding is
> > right..
> >
> >
> >
> > --
> > Luciano Resende
> > http://people.apache.org/~lresende
> >
> >
>
>
Re: [DAS] ApplyChnages fails in a table with generated primary key... and added DO does not include a modified property...
Posted by Adriano Crestani <ad...@gmail.com>.
Maybe it has something to do with ths thread:
http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg11303.html
Adriano Crestani
On 12/20/06, Luciano Resende <lu...@gmail.com> wrote:
>
> So, i was trying to create a test case for :
>
> Insert with no changed properties to row with generated ID (you could
> duplicate the test above with Company since it has a generated ID)
>
> public void testPartialReadInsertApplyWithGeneratedID() throws Exception {
>
> DAS das = DAS.FACTORY.createDAS(getConnection());
> // Read some customers
> Command select = das.createCommand("Select * from COMPANY");
> DataObject root = select.executeQuery();
>
> //Remember count
> int count = root.getList("COMPANY").size();
>
> // Create a new customer
> root.createDataObject("COMPANY");
>
> // Build apply changes command
> das.applyChanges(root);
>
> // verify insert
> root = select.executeQuery();
> assertEquals(count + 1, root.getList("COMPANY").size());
>
> }
>
> DAS is generating the following SQL :
> insert into COMPANY(ID, NAME, EOTMID) values (?, ?, ?)
>
> And it's causing the following exception
> SQL Exception: Attempt to modify an identity column 'ID'.
>
> My understanding is that, when IDs are automaticaly generated primary
> keys,
> they should not be part of the INSERT statement.
> Before I create a JIRA, I just want to make sure my understanding is
> right..
>
>
>
> --
> Luciano Resende
> http://people.apache.org/~lresende
>
>
Re: [DAS] ApplyChnages fails in a table with generated primary key...
and added DO does not include a modified property...
Posted by Kevin Williams <ke...@qwest.net>.
You are not providing any configuration to indicate the generated key.
BTW, Brent mentioned that this test case is covered by:
GeneratedId.testInsert5()
Luciano Resende wrote:
> So, i was trying to create a test case for :
>
> Insert with no changed properties to row with generated ID (you could
> duplicate the test above with Company since it has a generated ID)
>
> public void testPartialReadInsertApplyWithGeneratedID() throws
> Exception {
>
> DAS das = DAS.FACTORY.createDAS(getConnection());
> // Read some customers
> Command select = das.createCommand("Select * from COMPANY");
> DataObject root = select.executeQuery();
>
> //Remember count
> int count = root.getList("COMPANY").size();
>
> // Create a new customer
> root.createDataObject("COMPANY");
>
> // Build apply changes command
> das.applyChanges(root);
>
> // verify insert
> root = select.executeQuery();
> assertEquals(count + 1, root.getList("COMPANY").size());
>
> }
>
> DAS is generating the following SQL :
> insert into COMPANY(ID, NAME, EOTMID) values (?, ?, ?)
>
> And it's causing the following exception
> SQL Exception: Attempt to modify an identity column 'ID'.
>
> My understanding is that, when IDs are automaticaly generated primary
> keys,
> they should not be part of the INSERT statement.
> Before I create a JIRA, I just want to make sure my understanding is
> right..
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org