0%

Recently, I faced up a problem in my project. I tried to use generic type in my project, but when it came to the hibernate hql, I can not get the generic type. Following is the solution:

Let’s begin

Step 1:

Suppose I have a normal class like findById.

1
2
3
4
5
6
7
8
@Override
public User findById(Long id) {
String hql = "FROM User u where u.id = :userId";
Session s = sessionFactory.getCurrentSession();
TypedQuery<User> query = s.createQuery(hql);
query.setParameter("userId", id);
return query.getSingleResult();
}
Read more »

之前一直用的是买的的VPN,价格基本都是几十块一个月不等,其实想自己搭VPN很久了,就是一直懒,哈哈哈哈,前阵子抽空用AWS的EC2搭了一套VPN,粗略的加速了下,测试下来速度比买的Justmysocks速度快了一倍,看个Youtube 1080p完全不卡,进度条随意拖动,教程如下。

注册AWS账号

首先要注册一个AWS的账号,英文不好的童鞋可以把语言切换成中文。至于需要填什么,自己打开来看吧,因为我的账号注册了很久了,已经忘记了,应该要绑定一张支持全币种的Visa卡,Amazon会进行信用卡验证,刷取1刀的预授权来验证信用卡是否有效,不过后续会在账单上退回,不必担心。

Read more »

最近使用VPN科学上网时,导致了push到git的速度大幅减慢,最后还出现了push错误的情况,报错情况如下:

搜索了下说是因为科学上网的原因,但是试了很多方法都没用,以下是我最后解决的方法(也贴上查到的其他方法,希望总有一个适合你):
Read more »

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

blue test block
purple test block
yellow test block
green test block

Download Now

awesome pencil icon test

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Read more »