Most of the time you will find JPA’s auto scan mechanism for annotated entities very limited. It only scans paths starting from parent of classpath:META-INF/ folder from which persistence.xml is loaded. If you want to use persistence.xml file located in a different place, for example in a jar, your annotated entities won’t be scanned because […]
Category: Spring Framework
Weird Connection Problems with Spring and Hibernate
At the beginning of this week a colleague of mine said to me that some JDBC connections were left open in one of our web projects. Before continuing to the rest of the story, let me first draw a rough architectural picture of the project. We use JPA/Hibernate and Spring transactions decleratively in data access […]
How to Attach Zipped Content While Sending Mail
One of the things I most like about Spring is its approach in bringing a high level, easy to understand and use interface and configurability to several gradually lower level APIs of Java, such as JavaMail, JMS, JNDI and so on. Several days ago, a collegue of mine asked me whether I had any experience […]
Wiring a Bean with BeanReferenceFactoryBean
For some reason or other you may have more than one bean definition with same type configured in you application context, and you may want to use only one of them based on some condition or configuration option. For example, I have two PlatformTransactionManager beans configured in my application context. <bean id=”jdbcTransactionManager” class=”org.springframework.jdbc.datasource.DataSourceTransactionManager”> <property […]
Audit Logging at Service Level
What is Service Level Auditing? Many enterprise business applications have such requirements that they should log their users’ operations; who performs and when, records that are inserted into, deleted from database, or are changed during those operations, with a meaningful description about current state of those records. Hibernate already provides an interceptor mechanism at SessionFactory level. […]
Context Sharing Between Applet and Web Application
In our project we need to provide some supporting GIS functionality via an Applet GUI to our web based CRUD operations. Users, for example, may populate search criteria, entering input both from web interface, like name pattern, date range etc., and from Applet GUI, like selecting a specific region in a map, and then execute […]
A Hybrid SessionFactoryBean
LocalSessionFactoryBean is a nice way to create and initialize a Hibernate SessionFactory instance in applications. It lets us to configure other objects and properties, such as DataSource, and other hibernate properties that SessionFactory instance depends during initialization inside Spring?s context mechanism. We can easily configure other parts of our application, that are related with SessionFactory […]
Enabling Acegi (1)
We have decided to use Acegi Security Framework in order to implement security requirements in our web based project, but might possibly have diverse security requirements, in addition to form based authentication and role based authorization, such as remoting support, domain object security, run-as capability, SSO, after invocation security, certificate based authentication which is integrated […]
Extending XDoclet Spring Module
XDoclet is a wonderful tool, and we extensively make use of it in our current project to generate Hibernate and Spring configuration files. Our aim is to maintain no configuration file apart from our source code. XDoclet’s help is great in achieving this, but sometimes it requires modifications to keep up with that mission. We […]