完成springboot-hibernate升级
This commit is contained in:
@ -53,8 +53,9 @@ public class ArticleDAO implements IArticleDAO {
|
||||
@Override
|
||||
public boolean articleExists(String title, String category) {
|
||||
String hql = "FROM Article as atcl WHERE atcl.title = ? and atcl.category = ?";
|
||||
int count = entityManager.createQuery(hql).setParameter(1, title)
|
||||
.setParameter(2, category).getResultList().size();
|
||||
int count = entityManager.createQuery(hql)
|
||||
.setParameter(0, title)
|
||||
.setParameter(1, category).getResultList().size();
|
||||
return count > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ logging:
|
||||
spring:
|
||||
profiles: dev
|
||||
datasource:
|
||||
url: jdbc:mysql://127.0.0.1:3306/pos?useSSL=false&autoReconnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8
|
||||
url: jdbc:mysql://127.0.0.1:3306/pos?serverTimezone=UTC&useSSL=false&autoReconnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8
|
||||
username: root
|
||||
password: 123456
|
||||
|
||||
@ -46,7 +46,7 @@ logging:
|
||||
spring:
|
||||
profiles: test
|
||||
datasource:
|
||||
url: jdbc:mysql://127.0.0.1:3306/pos?useSSL=false&autoReconnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8
|
||||
url: jdbc:mysql://127.0.0.1:3306/pos?serverTimezone=UTC&useSSL=false&autoReconnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8
|
||||
username: root
|
||||
password: 123456
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@ -23,6 +24,7 @@ import static org.hamcrest.Matchers.nullValue;
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@Transactional
|
||||
public class ApplicationTests {
|
||||
private static final Logger log = LoggerFactory.getLogger(ApplicationTests.class);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user