You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Øyvind Harboe <oy...@zylin.com> on 2011/02/18 08:51:43 UTC

Regression in my application after switching to Cayenne 3.0.1/3.1 due to new feature

I had to fix a regression in my application switching to Cayenne 3.1:

Previously when I had a table that didn't have a primary key set in
MS SQL, things would work fine, now I get this error message:

[v.3.1-SNAPSHOT Jan 18 2011 07:59:35] Won't be able to create ObjectId
for 'Users'. Reason: DbEntity 'users' has no Primary Key defined.


The problem turned out to be that my application now has to check
for a new kind of merger token. When checking the model against the database,
I want to update the model with e.g. length of string fields, etc. This allows
database maintainers to simply modify the length of string column using
their beloved MS SQL Manager.


			if (token.getDirection() == MergeDirection.TO_DB)
			{
				token = token.createReverse(dataNode.getAdapter()
						.mergerFactory());
			}

			if (token instanceof SetPrimaryKeyToModel)
			{
                                // NEW!!!!
				// We don't care if the database has a primary key or not, skip!
				continue;
			}

-- 
Øyvind Harboe

Can Zylin Consulting help on your project?

US toll free 1-866-980-3434 / International +47 51 87 40 27

http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer