lMasterSparkl commented on issue #7703:
URL: 
https://github.com/apache/shardingsphere/issues/7703#issuecomment-1070125715


   > Through the sql that you execute, shardingsphere cannot determine whether 
did column has changed, so you need to specify value of did in where condition. 
By comparing did value in set clause with did value in where condition, 
shardingsphere can determine whether the data node has changed due to update 
statement.
   
   oh I understand, I will try to find the way for jpa's save method that 
append 'where did=xxx' in it's update sql . because now I use nativeQuery such 
as 
   ```
       @Transactional
       @Modifying
       @Query(value = "update post set update_dt = now(),text=:#{#post.text} , 
images=:#{#post.images},videos=:#{#post.videos}" +
               
",base_like=:#{#post.baseLike},base_share=:#{#post.baseShare},is_top=:#{#post.getIsTop()},tag=:#{#post.tag}
  " +
               "where did = :#{#post.did} and id = :#{#post.id}", nativeQuery = 
true)
       void updatePost(Post post);
   ```
   
   in actually we have many columns to update and it's complex with just append 
sharding column in where sentence , in addition   I need to judge every column 
is or not null .  I think use nativeQuery is  Not the original intention that 
use jpa. Can you give some suggestion to optimization this code.thx


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to