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

Insert with ifNotExists not working correctly #299

Open
mtillberg opened this issue May 13, 2024 · 0 comments
Open

Insert with ifNotExists not working correctly #299

mtillberg opened this issue May 13, 2024 · 0 comments
Assignees
Labels

Comments

@mtillberg
Copy link

When using the DAO mapper to create a method in the form:

@Insert(ifNotExists = true)
Object save(Object obj);

When a new record is inserted, an Object is returned with null for all fields, rather than returning null as expected from the documentation. The issue seems to be in com.datastax.oss.driver.internal.mapper.DaoBase.asEntity(). The check for returning null includes row.getColumnDefinitions().size() == 1, however what's in the Row is the expected '[applied]' column along with columns for each field in the table with null values. Additionally, the '[applied]' column exists regardless of whether the row was inserted or not so it may be better to check the value of the applied column rather than rely on the column count.

This was seen with java-driver-core and java-driver-mapper-runtime v4.17.0.0 against Scylla 5.4.6-0.20240418.10f137e367e3 from Docker.

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

No branches or pull requests

3 participants