Mapping Problems : Composite Key for Identity column

Mapping Problems : Composite Key for Identity column

Postby rvadone » Tue 17 May 2011 09:18

Hello,

Am working on the mapping Composite Keys(NUMBER+ CLIENTID) for
Table , Here both these keys are primary Keys and NUMBER field is
autogenerated and set as Identity in Database. am facing a problem
for mapping these fields as composite keys.

Error : "a different object with the same identifier value was already
associated with the session"..---> this is becoz in Database this
column is already set as Identity Column ..

Please refer the below code

public cliPendingBankruptcyMap()
{
Table("cliPendingBankruptcy");
LazyLoad();
CompositeId()
.KeyReference(x => x.usrClient, "CLIENTID")
.KeyProperty(x => x.NUMBER, "NUMBER");// HOW TO SET
THIS FIELD AS IDENTITY.
Map(x => x.NAME).Column("NAME");
Map(x => x.CASENO).Column("CASENO");
Map(x => x.DATE).Column("DATE");
Map(x => x.DISTRICT).Column("DISTRICT");
Map(x => x.RELATION).Column("RELATION");
Map(x => x.JUDGE).Column("JUDGE");
}

How can we set the Identity property for NUMBER field in the above
CompositeId()?? , So what approach should we need to follow for
mapping the NUMBER field as Identity in the above code.

Your thoughts?
rvadone
 
Posts: 1
Joined: Tue 17 May 2011 09:11

Postby Shalex » Wed 18 May 2011 10:56

1.
rvadone wrote:NUMBER field is autogenerated and set as Identity in Database.

Do you mean that you have a sequence and a corresponding OnInsert trigger for NUMBER's table in your database?

2.
rvadone wrote:Error : "a different object with the same identifier value was already
associated with the session"..---> this is becoz in Database this
column is already set as Identity Column ..

a) which ORM and its version are you using?
b) - If you encounter a problem with functionality (or interface) of this ORM tool, please contact its support team.
- If the problem is caused by dotConnect for Oracle, please send us a small test project with the corresponding DDL/DML script so that we can reproduce the issue in our environment. Also specify your version (x.xx.xxx) of dotConnect for Oracle.

While debugging, try using dbMonitor tool to perform per-component tracing of database events such as commit, rollback, SQL statement execute etc.
Download link: http://www.devart.com/dbmonitor/dbmon3.exe
Documentation: http://www.devart.com/dotconnect/oracle ... nitor.html

We offer our own ORM solutions: LinqConnect and the Entity Framework support.
Shalex
Devart Team
 
Posts: 7460
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle