小编Amr*_*ora的帖子

如何在Spring Data中使用@Transactional?

我刚刚开始研究Spring-data,Hibernate,MySQL,JPA项目.我切换到spring-data,这样我就不用担心手工创建查询了.

我注意到@Transactional当你使用spring-data时不需要使用,因为我也在没有注释的情况下尝试了我的查询.

我应该/不应该使用@Transactional注释的具体原因是什么?

作品:

@Transactional
public List listStudentsBySchool(long id) {
    return repository.findByClasses_School_Id(id);
}
Run Code Online (Sandbox Code Playgroud)

还有效:

public List listStudentsBySchool(long id) {
    return repository.findByClasses_School_Id(id);
}
Run Code Online (Sandbox Code Playgroud)

提前致谢!

java spring jpa spring-data spring-data-jpa

68
推荐指数
1
解决办法
7万
查看次数

在HTML中,使用div而不是使用表有什么好处?

经过多年的后端算法和分析工作,我最近被迫做了一些"HTML工作".(而且你们现在有一些叫做jQuery的东西,是吗?)Anyhoo,当我以前做HTML时(在XHTML之前),表非常常见.现在,我看到了对"div"和"无表格"等敬意的大量支持.为了赶上我错过的岁月,div比桌子更受欢迎的原因是什么?[我最近尝试在div中做一个简单的两列表(66%,33%),并且瘀伤仍然很新鲜.

我意识到问题可能是主观的,所以作为一个特定的子问题:什么是简单和简洁的基于div的HTML,呈现下表:

<table>
      <tr>
         <td width="33%">Name</td>
         <td width="67%">Description</td>
     </tr>
     <tr>
         <td>National Hockey League</td>
         <td>A much longer paragraph about the league</td>
    </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

html html-table

2
推荐指数
1
解决办法
5256
查看次数

标签 统计

html ×1

html-table ×1

java ×1

jpa ×1

spring ×1

spring-data ×1

spring-data-jpa ×1