This question is locked. New answers and comments are not allowed.
Sebastien AUROUX
Top achievements
Rank 1
Sebastien AUROUX
asked on 12 Oct 2010, 12:07 PM
If i understand well if i want to insert a new object, i need to create a lookup table that invoke the sequence to insert the primary key, and configure openaccess to use this table to insert a new object. And this the only way to insert a new object in oracle and have the PK afterward in the code ?
Is it possible to configure a different lookup table for each object ?
how can i configure all this information in openaccess in the Visual Designer ?
thanks for your help
4 Answers, 1 is accepted
0
IT-Als
Top achievements
Rank 1
answered on 12 Oct 2010, 02:09 PM
Hi Sebastien,
If you use the HighLow key generator (can be configured per persistent class) OpenAccess will take care of getting the next Id (per persistent class type) from a sequence and it is available after either a commit (SaveChanges()) or a flush (not in the context api yet)
Regards
Henrik
If you use the HighLow key generator (can be configured per persistent class) OpenAccess will take care of getting the next Id (per persistent class type) from a sequence and it is available after either a commit (SaveChanges()) or a flush (not in the context api yet)
Regards
Henrik
0
Sebastien AUROUX
Top achievements
Rank 1
answered on 12 Oct 2010, 03:07 PM
thank you for your help
but how can i configure the high low in the visual designer?
thanks again
but how can i configure the high low in the visual designer?
thanks again
0
IT-Als
Top achievements
Rank 1
answered on 12 Oct 2010, 03:11 PM
Hi Sebastien,
Sorry, was in the middle of writing to you - as I realized I gave you some wrong information.
I didn't read careful the questions and I didn't realize it was in the Visual Designer, so I gave you an answer geared towards the Classic approach.
As far as I know there's no way to set the key generator in the Visual Designer VS tools, maybe it can be set in the xml or attributes.
Regards
Henrik
Sorry, was in the middle of writing to you - as I realized I gave you some wrong information.
I didn't read careful the questions and I didn't realize it was in the Visual Designer, so I gave you an answer geared towards the Classic approach.
As far as I know there's no way to set the key generator in the Visual Designer VS tools, maybe it can be set in the xml or attributes.
Regards
Henrik
0
Hi Henrik, Sebastien
Actually there is a way to set up the classes to use the HighLow key generator and you can easily do so by selecting a class in the diagram, pressing F4 which will open up the property pane and in the Identity Mechanism select HighLow.
However with Oracle this might not be the best idea, if you have database objects, with defined sequences and triggers over the identities you can set up OpenAccess in such a way that this is respected and identities are automatically retrieved, which I think is what you are trying to achieve.
When you are using MS SQL and you reverse map an auto-incremental column you get a property that is populated after the SaveChanges() call. In Oracle however as this is done with sequences and triggers our schema read cannot (at the moment) read this information. This means that you will have to explicitly set this up. What you need to do is locate the desired class again press F4 and in the same property select BackendCalculated as the value. Make sure that the property that is mapped to your auto incremental column is set up as a primary key. Then go to the Schema Explorer and locate the table this class is mapped to, right click and select Edit Table, then find the column you want calculated and set it up as a Backend Calculated column.
After you have completed these steps, whenever you insert a new object and persist the changes to the database you will get the identity property of your newly inserted object populated with the new value.
I hope this proves to be helpful to you.
Regards,
Serge
the Telerik team
Actually there is a way to set up the classes to use the HighLow key generator and you can easily do so by selecting a class in the diagram, pressing F4 which will open up the property pane and in the Identity Mechanism select HighLow.
However with Oracle this might not be the best idea, if you have database objects, with defined sequences and triggers over the identities you can set up OpenAccess in such a way that this is respected and identities are automatically retrieved, which I think is what you are trying to achieve.
When you are using MS SQL and you reverse map an auto-incremental column you get a property that is populated after the SaveChanges() call. In Oracle however as this is done with sequences and triggers our schema read cannot (at the moment) read this information. This means that you will have to explicitly set this up. What you need to do is locate the desired class again press F4 and in the same property select BackendCalculated as the value. Make sure that the property that is mapped to your auto incremental column is set up as a primary key. Then go to the Schema Explorer and locate the table this class is mapped to, right click and select Edit Table, then find the column you want calculated and set it up as a Backend Calculated column.
After you have completed these steps, whenever you insert a new object and persist the changes to the database you will get the identity property of your newly inserted object populated with the new value.
I hope this proves to be helpful to you.
Regards,
Serge
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items