English 中文(简体)
春天与温伯和最佳做法
原标题:Spring Transactions with Hibernate and SQL best practice

我们目前正在利用春天中心实施教育、科学和技术部的网络服务。 我们现在想要执行某种数据持久性,我正在考虑这些选择。 春天交易会+热利特 + MySQL似乎是一个相当受欢迎的办法,但我所研究的每一个博客/理论都不同。

谁能指导我如何看待使用春天进行数据的“最佳实践”? 我要说的是,这似乎更自然,对我来说是可以维持的。

但现在在某些地方,我已经读到,不应再使用<代码>HibernateTemplate。 有些人使用“Dao”接口和“DaoImpl”(@Repository办法,其他人则使用“@service/code>办法”的服务。

事先得到任何建议。

最佳回答

自愿就业岗位确实不十分有用,春狗建议不要再使用。

@Repository and @Service basically do the same thing, except (AFAIK) two things:

  • @Repository makes it clear that the service is a DAO, and not a business service
  • exceptions thrown from an @Repository annotated service are translated to Spring s persistence exception classes. This means that you won t get Hibernate exceptions, but Spring exceptions wrapping Hibernate ones.
问题回答

当藏匿国不支持每读一次会话的概念时,需要自行定时。 现在,更妥善的做法是直接使用常识法。

With Hibernate 另一个问题是,如果在业余有新鲜的皮,那么人们必须等到新发行的《自由星号》才能得到支持。

缩略语

HibernateTemplate 的使用在《经济、社会、文化权利国际公约》第二版的文件中受到阻碍。

http://static.mers.org/mers/docs/2.0.3/api/org/childrenframework/orm/hibernate3/HibernateTemplate.html

NOTE: As of Hibernate 3.0.1, transal Hibernate access Code can also becoded inwang Hibernate作案。 因此,对于新启动的项目,考虑采用标准Hibernate3风格的编码数据存取标语,而以Factory.getCurrentSession()为基础。 (Spring s LocalSessionFactoryBean auto support Spring trade management for the Hibernate3 RecCurrentSession() methods.)

@ 保存人或@SER.A的使用没有任何变化,但我认为,这些说明今后还会得到DAO/服务级别的进一步支持,从而使其使用更加准确。

我个人希望,如果“DAO层的保存者”能够划分我的服务和商业层面,就更喜欢使用。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...