I have migrated a database layer from NHibernate to Oracle EF Core 6.x
The Oracle database is the same.
One of the tables has an integer version column.
How can I get EF to increment the value? Have tried incrementing it on save but this gives me a concurrency exception.
Mapping of the column:
b.Property(x => x.Version).HasColumnName("VERSION").IsRowVersion();
I have also tried a timestamp but not sure what datatype to use in C# and Oracle.
Would also prefer to keep the integer version column. So I can avoid a datamigration.
Related
Am new to hiberante JPA. I am working on oracle to postgres migration and we are not using aws dms service for data migration. We would like to move ahead with Java for copying tables which have more than 1 million records. I have problem for below scenario.
Table A - Oracle
Table B - PostGres
Am extracting records from Oracle using ScrollableResults. Once i have the data from Oracle, i need to loop up a value in postgres database for data from Oracle before performing insert into postgres database.
I thought first #ColumnTransformer will help but it is not helping as i dont know how to reference data from oracle on ColumnTransformer expression.
So finally went ahead with writing normal insert query with values and subquery for lookup. Also set hibernate.jdbc.batch_size to 100.
I executed the program in this way and it took 5 mins for 10k records which i feel is slow.
is there any other solution for this problem to improve the performance.
Thanks for all your help
I found the solution. I solved it by storing postgres lookup table in list object then performing search in lookup table list object before performing insert. Now the speed is good.
We have a legacy app that I am rewriting in .net. All of our databases are oracle and make use of database links. Is there any way for Entity Framework 6 to generate models based on tables located on a different database?
Currently the legacy app gets data from table like this
SELECT * FROM emp#foo2;
where its db connection is to database foo that has a database link to the database foo2.
I would like to reproduce this using EF6. So far all I have found regarding this is this question.
You can do two things that EF 4 or higher will work with:
CREATE VIEW EMP as SELECT * FROM emp#foo2;
CREATE MATERIALIZED VIEW EMP as SELECT * FROM emp#foo2;
LOBS are not accessible across a database link without some contorted PL/SQL processing to read the LOB piece by piece.
I believe fast refresh does not work across database links so you must consider the size of the table on the linked database. If you are refreshing a million rows you may find the time to do this is an issue. Most large tables are full of tombstone data that never changes so a timestamp column with the last modified date could help you create a package that only picks out the changed data.
If you are doing complicated joins for either ensure that Oracle considers the column that would be the primary key as not null.
You can add a primary key on views and materialized view but it must be disabled. See here for details.
I'm joining a sybase table and a sas data set to insert/update data using a table loader in oracle. The table ID needs to be loaded using a sequence which resides in oracle. Can you please let me know how to use an oracle sequence to generate a ID column? I tried adding a dummy column to the same oracle table joined it to the result set and tried specifying seqname.nextval in a expression editor but getting an error:
ERROR: Unresolved reference to table/correlation name seqname.
If you need to use this kind of oracle-specific functionality with DI Studio you will need to use a custom code step and write the SQL yourself within a 'proc sql' passthrough statement.
If the code is to be re-used in several places you also have the option to write it as a DI transformation.
I have a problem in Entity Framework using Oracle. I get the error ORA-01792: maximum number of columns in a table or view is 1000.
The particular Linq which throws the error has 5 Include. when using SQL provider it uses only MSL fiels but with Oracle it uses all fields in SSDL which exceeds 1000 columns.
Is there a way to force to use the fiels only in MSL for Oracle ?
I have 62 columns in a table under SQL 2005 and LINQ to SQL doesn't handle the updates though the reading would work just fine, I tried re-adding the table to the model, created a new data model but nothing worked, I'm guessing I've hit the maximum number of columns limit on an object, can anyone explain that ?
I suspect there is some issue with an identity or timestamp column (something autogenerated on the SQL server). Make sure that any column that is autogenerated is marked that way in the model. You might also want to look at how it is handling concurrency. If you have triggers that update any values on the row after it is updated (changing values) and it is checking all columns on updates, this would cause the update to fail. Typically I create my tables with a timestamp column -- LINQ2SQL picks this up when I generate the model and uses it alone for concurrency.
Solved, either one of the following two
-I'm using a UniqueIdentifier column that was not set as Primary key
-Set Unique ID primary key, checked the properties of the same column in Server Explorer and it was still not showing as Primary key, refreshed the connection,dropped the same table on the model and voila.
So I assume I made a change to my model some time before, deleted the table from the model and added the same from the Server explorer without refreshing the connection and it never used to work.
Question is, does VS Server Explorer maintain it's own table schema and requires connection refresh everytime a change is made in the database ?
There is no limit to the number of columns LINQ to SQL will handle.
Have you got other tables updating successfully?
What else is different about how you are accessing the table content?