NorthConcepts / DataPipeline-Examples

DataPipeline Examples
Apache License 2.0
17 stars 5 forks source link

jdbcUpsertWriter #23

Open Sukanyavrg opened 4 years ago

Sukanyavrg commented 4 years ago

Hi Team, I am new to Datapipeline concept. I am facing issue with jdbcUpsertWriter() with sql server DB ,throws " Violation of PRIMARY KEY constraint ,Cannot insert duplicate key in object " but same will work with oracle DB.

Can you please guide me in resolving the error.

Thanks in Advance.

DeleTaylor commented 4 years ago

Hi, can you post the full exception?

Sukanyavrg commented 4 years ago

Sorry sir, Due to security reasons, i dodn't have permissions to share complete stack trace.

Error: com.microsoft.sqlserver.jdbc.SQLServerException: Violation of PRIMARY KEY constraint 'Xpktablename. Cannot insert duplicate key in object 'dbo.tablename'.

DeleTaylor commented 4 years ago

Can you try using new GenericUpsert().setInsertFirst(false) as in the following example to force updates to happen first?

https://github.com/NorthConcepts/DataPipeline-Examples/blob/master/src/main/java/com/northconcepts/datapipeline/examples/cookbook/WriteToDatabaseUsingGenericUpsert.java

Sukanyavrg commented 4 years ago

Hi Sir, Getting below error on using the line new GenericUpsert().setInsertFirst(false) Error: The method setInsertFirst(boolean) is undefined for the type GenericUpsert

Sukanyavrg commented 4 years ago

Hi Sir, Is there any other way round to make it work in both oracle and SQL Server for updating part.

DeleTaylor commented 4 years ago

Please use the latest snapshot to get the method you need. Replace the version you're using with 6.0.0-SNAPSHOT.