Month: May 2010

[Spring Testing] Call hibernateTemplate.flush() manually

http://static.springsource.org/spring/docs/2.5.6/reference/testing.html 8.3.7.5.2. JUnit 4.4 support classes simpleJdbcTemplate: useful for querying to confirm state. For example, you might query before and after testing application code that creates an object and persists it using an ORM tool, to verify that the data appears in the database. (Spring will ensure that the query runs in the scope of …

[Spring Testing] Call hibernateTemplate.flush() manually Read More »

[Hibernate] How to have 2 collections of the same type in JPA/Hibernate?

这种情况这么办? public class Parent{ private List<String> sons; //我希望把这个关系映射到 parent_child 表 private List<String> daughters; //我希望把这个关系也映射到 parent_child 表 } 答案是: You can’t do it. 看这个URL: [url] http://stackoverflow.com/questions/669828/how-to-have-2-collections-of-the-same-type-in-jpa[/url]

[Relearn Spring] 4 Transaction Management

Annotation based Management   1. Use @Transactional along with <tx:annotaion-driven/>   2. Note: Calling a @Transactional method in the same class will not take effect if you are not using AspectJ for AOP. It’s OK to use HibernateTransactionManager with JdbcTemplate   here it is: 引用 This transaction manager is appropriate for applications that use a …

[Relearn Spring] 4 Transaction Management Read More »

[Relearn Spring] 3 Resource

1. ‘Resource’ is actually a more powerful version of java.net.URL.     What’s more, Spring suggests you use it as a generic utility class, even without Spring. 2. Built-in Implementations.     a.UrlResource     b.ClasspathResource     c.FileSystemResource     d.ServletContextResource     e.InputStreamResource     f.ByteArrayResource