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

Issue in updateValue(Object id, clazz, String propertyName, Object value) function. #57

Open
rahulsrivastava71 opened this issue May 21, 2015 · 3 comments

Comments

@rahulsrivastava71
Copy link

We used this function to update values in cassandra but when sending the value Object value as null the code is giving exception , while if updating manually from CQLSH cammand it updates the value to null, so if i have to update a value to null how to do it using updateValue() function of valchkou mapper.

@valchkou
Copy link
Owner

I will check what's going on here,
also you may call deleteValue() which is equivalent to setting null for cassandra.

@rahulsrivastava71
Copy link
Author

please check it , and let us know because we are using this function for updating values.

@rahulsrivastava71
Copy link
Author

Hi Eugene,
I checked code for UpdateValues() and found that ,
public static void setValueToUpdateStatement(EntityTypeMetadata emeta, Update update, String propertyName, Object value) {
EntityFieldMetaData fmeta = emeta.getFieldMetadata(propertyName);
if (value.getClass().isEnum()) //Giving null pointer exception here.
{
value = ((Enum<?>) value).name();
}
update.with(set(fmeta.getColumnName(), value));
}
This function is been used internlly to update the values but as we can see that if i pass I want to set a value to null it will come in this code and give null pointer exception in if condition as its performing operation on value as value.getClass() here if value is null it will null pointer exception ,
and coming back to your suggestion of updating values to null by using deleteValue() function i can make null only single value at a time as there is no deleteValues() kind of function so to make multiple columns null i will have to execute this deletevalue() query multiple times.

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