[DAS] ApplyChnages fails in a table with generated primary key... and added DO does not include a modified property...

2006-12-20 Thread Luciano Resende

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

2006-12-20 Thread Adriano Crestani

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 <[EMAIL PROTECTED]> 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...

2006-12-20 Thread Luciano Resende

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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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...

2006-12-20 Thread Kevin Williams

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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]