小编Kar*_*hik的帖子

无法为Java SE标准类解析导入XXX

我使用Eclipse,结果我有一堆import * not resolved的错误.

import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
Run Code Online (Sandbox Code Playgroud)

以上所有都有相同的错误.我检查了我的java版本是1.7.0 open jdk.我更新了Java Home和JRE库以供使用.它仍然无法正常工作.注意:我通过mercurial插件本身从bibucket导入了代码库.

java eclipse

30
推荐指数
2
解决办法
24万
查看次数

JpaRepository: No Transaction in progress

I'm using Spring Data Jpa along with hibernate. I have a repository that extends JpaRepository and I'm using it to save records to the database. But when I call .flush(), the following error occurs.

I've seen other questions with a similar error but after trying to use @Transaction in the repository as well, I get the same error.

Caused by: javax.persistence.TransactionRequiredException: no transaction is in progress
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.checkTransactionNeeded(AbstractEntityManagerImpl.java:1171)
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:1332)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at …
Run Code Online (Sandbox Code Playgroud)

spring hibernate spring-data-jpa

5
推荐指数
1
解决办法
7608
查看次数

标签 统计

eclipse ×1

hibernate ×1

java ×1

spring ×1

spring-data-jpa ×1