INSERT new record

Jan 30, 2009 at 8:12 AM

first of all, I have to say "you have done great job with this project". Everithing is working fine, but I get little stuck with inserting new record.
I didnt use mapping generator at all, because I'd like to understant how does it work, so the following problem is : When I'm trying insert new record
I get error ORA-00904 which is "invalid identifier" during checking  SQL query which was generated by LINQ statement, I've find out bug inside of
converting method.

Here is the generated code.:
INSERT INTO my_tb ( Last_Name, First_Name ) VALUES ( :p0, :p1 );
OPEN :p2 FOR SELECT t0.Employee_Id FROM my_tb t0 WHERE t0.Employee_Id = ( CONVERT ( Int32, IDENTITY) );

As you see the problem is inside of WHERE clause, where is bad data type Int32.
The property Employee_Id is data type int and has this attribute [Column(Storage = "employee_id", DBType="NUMBER NOT NULL ENP_SQ" Id=true, AutoGen=true)].

Could anyone give me some advice with that?
Regards n00by
Feb 9, 2009 at 8:12 PM

sorry for my late, I'm very busy,

I think that your problem come from the attribute delcaration,

in fact, you should have something like [ColumnAttribute(Storage="employee_id", DBType="NUMBER IDENTITY ENP_SQ", Id = true, Autogen = true)]

please, let me know if you have solved your problem,

thank you very much
Feb 10, 2009 at 6:15 AM
Hi again,
so, I've done everything as you wrote above, and many other combinations, but the problem is still the same as before.
My opinion is that the parser of C# code to SQL has same issue, because there is sitl Int32 data type from .NET.

I didn't use any explicit declaration of IDENTITY variable, only inside of DBType="" parameter, but there is NUMBER, and the other
queistion is why is used method CONVERT(type, variable) when we have IDENTITY declared as Number why another convertion?

I'd like use your api, because it can make my work easier with .NET/Oracle.

Kind regards
Feb 10, 2009 at 10:16 AM

I will try to find a solution for your problem quickly

and post a new release in next days,

thanks for your patience
Feb 10, 2009 at 11:23 AM

Please, could you send me your generated class you use for the mapping ?

I think that the parser has a problem with the column's definition.

Thank you
Feb 10, 2009 at 6:17 PM
Ok, I'll send you my mapping class with other separate classes, that implements all data access.
Please give me your mail.

Feb 11, 2009 at 5:26 AM

your problem comes from the property declaration,

for the moment, ORACLE sequence are converted to decimal .NET type,

so you must use decimal .NET type for this kind of property,

the support of integer will be released in the next version,

in this manner, the CONVERT function will be removed

Feb 11, 2009 at 6:17 AM
that's work great now.
I'm very glad to help you with that.

Regards n00by