我在谷歌上搜索了很多,Spring Boot(最新版本)可能没有延迟加载不起作用,这真的很奇怪。以下是我的代码片段:
我的资源:
public ResponseEntity<Page<AirWaybill>> searchAirWaybill(CriteraDto criteriaDto, @PageableDefault(size = 10) Pageable pageable{
airWaybillService.searchAirWaybill(criteriaDto, pageable);
return ResponseEntity.ok().body(result);
}
Run Code Online (Sandbox Code Playgroud)
我的服务:
@Service
@Transactional
public class AirWaybillService {
//Methods
public Page<AirWaybill> searchAirWaybill(AirWaybillCriteriaDto searchCriteria, Pageable pageable){
//Construct the specification
return airWaybillRepository.findAll(spec, pageable);
}
}
Run Code Online (Sandbox Code Playgroud)
我的实体:
@Entity
@Table(name = "TRACKING_AIR_WAYBILL")
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@airWaybillId") //to fix Infinite recursion with LoadedAirWaybill class
public class AirWaybill{
//Some attributes
@NotNull
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "FK_TRACKING_CORPORATE_BRANCH_ID")
private CorporateBranch corporateBranch;
}
Run Code Online (Sandbox Code Playgroud)
并且在调试时,我仍然会加载所有延迟加载的属性。见下图。
我的问题之一是杰克逊会参与这种行为吗?有什么方法我可能错过了激活延迟加载?
编辑
另一个问题,调试器是否会参与破坏延迟加载?
编辑2:
对于规范构建,我有:
public static Specification<AirWaybill> …Run Code Online (Sandbox Code Playgroud) 我试着在这里使用ionic/cordova插件.
所以我把这段代码放在我的页面中:
showDocument() {
var options: DocumentViewerOptions = {
title: 'A book',
documentView: { closeLabel: '' },
navigationView: { closeLabel: '' },
email: { enabled: true },
print: { enabled: true },
openWith: { enabled: true },
bookmarks: { enabled: true },
search: { enabled: false },
autoClose: { onPause: false }
}
this.docViewer.viewDocument('assets/arabic.pdf', 'application/pdf', options);
}
Run Code Online (Sandbox Code Playgroud)
还有一个简单的按钮可以在html页面中启动它:
<ion-content>
<button ion-button round (click)="showDocument()">
Read
</button>
</ion-content>
Run Code Online (Sandbox Code Playgroud)
但我在模拟器中看不到任何内容(因为无法在浏览器上运行它)
离子信息在那里:
更新:
这是我使用我的设备和chrome devtools进行调试时得到的结果:
更新2:
我试图使用绝对路径,但我有空值,我做了这些更改:
import …Run Code Online (Sandbox Code Playgroud) 我有这个类专门用于通过hibernate的persistance层在db中保存数据.
public class TLinkEquipementDAOImpl implements TLinkEquipementDAO {
private static final Log log = LogFactory
.getLog(TLinkEquipementDAOImpl.class);
@PersistenceContext
private EntityManagerFactory emf = PersistenceManager.getInstance()
.getEntityManagerFactory();
private EntityManager entityManager = emf.createEntityManager();
private EntityTransaction tx = entityManager.getTransaction();
public void persist(TLinkEquipement transientInstance) {
log.debug("persisting TLinkEquipement instance");
try {
tx.begin();
entityManager.persist(transientInstance);
tx.commit();
log.debug("persist successful");
} catch (RuntimeException re) {
tx.rollback();
log.error("persist failed", re);
throw re;
}
}
//Staff
}
Run Code Online (Sandbox Code Playgroud)
问题是它不会持久存储数据.
堆栈是:
Exception in thread "main" java.lang.IllegalStateException: Transaction not active
at org.hibernate.ejb.TransactionImpl.rollback(TransactionImpl.java:82)
at sau.se.domain.dao.Impl.TLinkEquipementDAOImpl.persist(TLinkEquipementDAOImpl.java:47)
at sau.se.domain.service.Impl.TLinkEquipementServiceImpl.persist(TLinkEquipementServiceImpl.java:29)
at sau.se.extractor.InfoExtract.getAllSPData(InfoExtract.java:346) …Run Code Online (Sandbox Code Playgroud) 我正在使用C++和OpenCV开展机器人项目.在这一步中,我遇到了一个问题,包括:
我有两个方法moveRight()和moveLeft()我在我的代码依次调用,但问题是,第二个不运行,因为第一个需要时间(机器人运动的时间),但是当我把Sleep(5000)他们之间的(我猜那五一秒钟足够运动),一切都好.
什么是避免使用的编程解决方案Sleep(因为它会产生一些其他问题)?
我将开始在Android系统内核开发下工作,我没有想法。我所知道的是,我必须具备 Linux、c 和 C++ 方面的知识,而且我拥有所有这些知识,但我应该开始一些培训,所以我需要一些第一步。任何帮助,将不胜感激。谢谢大家
我想在 moment.js 中创建我自己的语言环境,它的父级应该是阿拉伯语本地环境,但我只想更改为显示的数字格式0-9,而不是默认显示。
根据文档,我可以从以下开始:
moment.defineLocale('ar-sa-mine', {
parentLocale: 'ar-sa',
/*
here I need to specify the numeric: change **this ?? to 29**
*/
});
Run Code Online (Sandbox Code Playgroud) evict我在理解和之间的区别时遇到了一些困难detach,evict无论如何都会分离会话,如果是的话,有什么区别?我读到它从二级缓存中删除了对象,但没有得到它。
两个结果之间有什么区别.
当我用键空值时
当密钥本身不存在时
在上面两个条件结果都是null.那么如何识别我的关键价值呢?
Map map = new HashMap();
map.put(1,null);
System.out.println(map.get(1));
System.out.println(map.get(2));
Run Code Online (Sandbox Code Playgroud)
回答:
null
null
Run Code Online (Sandbox Code Playgroud) 我有一个带有@Controllers和@RestControllers 的Spring MVC应用程序。我当时在想:当我遇到异常时@Controller,它将由我处理;@ControllerAdvice当我遇到异常时@RestController,将由我处理@RestControllerAdvice...但是现在,我认为这不是事情的工作方式,因为我@ControllerAdvice正在捕获所有内容,甚至是由@RestController... 引发的任何异常,我不知道是否应该发生这种情况。这是我的代码:
@ControllerAdvice
public class ExceptionHandlerController {
private final String DEFAULT_ERROR_VIEW = "error/default";
@ExceptionHandler(Exception.class)
public ModelAndView defaultErrorHandler(HttpServletRequest req, Exception e)
{
ModelAndView mav = new ModelAndView();
mav.addObject("exception", e);
mav.addObject("danger", e.getMessage());
mav.addObject("url", req.getRequestURL());
mav.setViewName(DEFAULT_ERROR_VIEW);
return mav;
}
}
@RestControllerAdvice
public class ExceptionHandlerRestController {
@ExceptionHandler(Exception.class)
public ResponseEntity<String> defaultErrorHandler(HttpServletRequest req, Exception e) throws Exception {
return new ResponseEntity<>(" test "+e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
Run Code Online (Sandbox Code Playgroud) 一直有问题IE.
在我的网页中,我在本地JQuery包括:
<script type="text/javascript" src="../jsp/jquery-2.0.2.min.js"></script>
<script type="text/javascript" src="../jsp/jquery-ui-1.10.3.custom.js"></script>
<script type="text/javascript" src="../jsp/init.js"></script>
<script type="text/javascript" src="../jsp/tajweed.js"></script>
<script type="text/javascript" src="../jsp/tajweed-tools.js"></script>
Run Code Online (Sandbox Code Playgroud)
但是,它给出了这些错误:
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3)
Timestamp: Thu, 25 Jul 2013 10:17:38 UTC
Message: 'JSON' is undefined
Line: 4
Char: 562
Code: 0
URI: http://localhost/play/jsp/jquery-2.0.2.min.js
Message: 'jQuery' is undefined
Line: 6
Char: 1
Code: 0
URI: …Run Code Online (Sandbox Code Playgroud) 我需要创建一个enumeration这样的:
public enum STYLE {
ELEMENT1(0), A/R (2)
//Staff
};
Run Code Online (Sandbox Code Playgroud)
但Java不允许这样做.有什么解决方案吗?谢谢
我试图在3个输入中找到最小的数字.这是我的代码:
int main ()
{
double x = 4.0;
double y = 5.0;
double z = 3.0;
smallest(x,y,z);
cout << smallest << endl;
system("PAUSE");
}
double smallest(double x, double y, double z)
{
double smallest;
if ((x < y)||(x< z)) {
smallest = x;
} else if ((y < z)||(y < x)) {
smallest = y;
} else {
smallest = z;
}
return smallest;
}
Run Code Online (Sandbox Code Playgroud)
但是,我一直在收到错误.它声明了我在main方法中使用未声明标识符的最小方法.这在使用eclipse但不是visual studio时有效.有人可以向我解释原因吗?
提前致谢.
更新部分.
所以我试着对这个程序进行验证.我想确保用户只输入号码,这里是我的代码:
double x, y, z;
bool correct_input = false;
do{ …Run Code Online (Sandbox Code Playgroud) java ×5
hibernate ×3
android ×2
c++ ×2
spring ×2
controller ×1
cordova ×1
enumeration ×1
enums ×1
if-statement ×1
javascript ×1
jpa ×1
jquery ×1
linux-kernel ×1
localization ×1
momentjs ×1
real-time ×1
robot ×1
slash ×1
spring-boot ×1