Hibernate query interface setDate method: bind parameters with mapping type of date
                                        
                    •
                    Java                                    
                Grammar 1
setDate(int position,Date date)
Example
String hql = "from UserForm where birthday=?";  //定义查询HQL语句
Query query = session.createQuery(hql);  //执行查询语句,获取Query对象
query.setDate(0,Date.valueOf("1998-11-17"));  //绑定HQL语句参数
Grammar 2
setDate(String name,Date date)
Example
String hql = "from UserForm where birthday=:birthday";  //定义查询HQL语句
Query query = session.createQuery(hql);  //执行查询语句获取Query对象
query.setDate("birthday",Date.valueOf("1998-11-17"));  //设置HQL语句请求参数值
list = query.list();  //执行HQL语句
                
                            The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
                        
                                            
                        THE END
                    
                    
                    
                                                        二维码
                        
                        
                                                
                        