Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to prevent duplicate inserts with em.persist (CQL : IF NOT EXISTS) #1019

Open
sohelmk opened this issue Jun 27, 2018 · 1 comment
Open

Comments

@sohelmk
Copy link

sohelmk commented Jun 27, 2018

Hi,
When we try to persist same entity with em.persist it does not throw an exception. Probably this is default cassandra behaviour with CQL also, it just updates if row exist. But CQL does offer IF NOT EXISTS clause to check this. How can we achieve same using Kundera?

Thanks,
Sohel Khan

@devender-yadav
Copy link
Contributor

Hi @sohelmk,

You can use entityManager.createNativeQuery().

Check testcase for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants