spring

Hibernate not creating table when using Spring DAO

I'm trying to use Spring DAO with Hibernate for a web application. When I try to persist information in the DAO using getHibernateTemplate().save("bar", bar); I get the following in Tomcat: org.springframework.dao.InvalidDataAccessResourceUsageException: could not insert: [com.enw.foo.domain.Bar]; nested exception is org.hibernate...

Can I ask JDBCTemplate to expand a list parameter for use in an in() clause?

Can I do something like this: select * from mytable m where m.group_id in (?) ... and pass in a list or array of arguments to be expanded in to my parameter, ie: select * from mytable m where m.group_id in (1,2,3,4) Specifically, I'm using Spring and the JdbcTemplate/SimpleJdbcTemplate classes. ...

I want to know , Is spring dependency injection create singleton object ? If yes how it manage internally?

I want to know , Is spring dependency injection create singleton object ? If yes how it manage internally? .. I want to know at what time this singleton object is created and destroy. ...

Please recommend best practice for integrating apache lucene with a MVC/spring web app

I've been working on a web application using Spring/MVC which is coming along nicely. We'd like to now integrate apache lucene to index a lot of the domain objects for a user search facility. I'm undecided if I should create an indexing service that's registered within spring or do it the traditional servlet way and implement a ServletC...

How to correctly deploy Spring based application on Tomcat?

What are the best practices for Spring based application deployment? I have at least two apps based on Spring. I'm deploying them on Tomcat - two instances of the same server with different CATALINA_BASE's. The result is that size of one of my apps is 30MB and the other is 19MB. Each has same libraries such as Spring, Apache CXF, Hibern...

Filter servlet with Spring : HTTP 500 error ...

Hi all, I followed this article : Spring and servlet filters to add a filter on a specific URL. I added my 'foo' class, which implements 'Filter' interface. But when I access to my specific URL, an Java exception is catch : java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered? My tech...

Spring/Hibernate: Do you have to load entities to use it after saving?

Hi all, I have a database model with two tables: Session and ScriptExecution which are associated with a one-to-many relationship: public class ScriptExecution implements Serializable { @ManyToOne @PrimaryKeyJoinColumn private Session session; ... } public class Session implements Serializable { @OneToMany(fetch=FetchType.EAGER...

Concurrent updates handling in hibernate..

Presently we are using JDBC in the data layer and planning to replace it with hibernate.I am new to Hiberante and not sure how hiberante handles concurrency. Can somebody explain me if we use spring for the transaction management, how concurrent updates will be handled by hibernate (In memory automatic version management of hibernate) or...

Captcha in spring roo

Hi, I wonder if anyone has ever experienced JCaptcha in spring roo? please share your ideas, thanks. ...

JDBC reconnect problems with Teradata driver using Spring and Apache DataSource

I'm using the Apache BasicDataSource for both commons DBCP and connection pool: org.apache.commons.dbcp.BasicDataSource and managing it through Spring: org.springframework.jdbc.datasource.DataSourceTransactionManager While using this combination with the Teradata JDBC driver if my database goes down or there is a network glitch I r...

setting view name in spring filter

I've an ErrorFilter which extends the spring GenericFilterBean. I want to show an error page decorated with tiles if some error happens. Is there any way to set a view name from the filter? <filter> <filter-name>errorFilter</filter-name> <filter-class>com.abc.filter.ErrorFilter</filter-class> <init-param> <param-nam...

Reading the content of property file in Spring Validator Class

Hi I am using Spring 3.0. Can i read a property file from a localdrive eg: C:\prop\mylogin.properties(not under webapps/application server) mylogin.properties login.heading=Login login.username=Username login.password_blank=Password cannot be blank I want to use the above in my Validator class(java bean class). Please Note : I usi...

what's spring framework?

hi everyone. i'm begginer for java spring framework. and how to configuration xml file. and what do to do modules. how to use those? mainly how to use spring framework? please advice me guys. ...

SpringMVC - Change view when accessed by Mobile

Hi All I was wondering if someone has already solved this. I have a SpringMVC app and we are adding support to WebKit type mobiles (iPhone and Android basically) so I was wondering someone has found an elegant way of defining specific views depending on the client that sent the request. I know that a simple if in a Controller implement...

Grails filters: Any way of chaining filters?

Hi, is there a way to chain several filters in a grails application (as in Java filters)? Maybe something with spring? I've written a couple of filters, and would like to get them to execute serially (order is not particularly important), and I need some help on achieving this. The reason behind? I need to write about 20, 30 filters, a...

How to pass a session attribute as method argument (parameter) with Spring MVC

In short, I want something like: public String action(@SessionAttribute User user) {..} instead of public String action(HttpSession session) { User user = session.getAttribute("user"); } Mainly for the sake of: readability unit testing ...

How to turn on read-only in Hibernate?

I am using Spring to create the SessionFactory: <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" p:dataSource-ref="dataSource"> <property name="mappingResources"> <list> <value>META-INF/mapping/domain-objects.xml</value> </list> </property> <pr...

applicationContext-service.xml problem definitions

Hi! Working with spring, below, the code of applicationContext-service.xml: <bean id="mediaObjectService" class="path.MediaObjectServiceImpl"> <property name="mediaObjectDao" > <ref bean="mediaObjectDao"/> </property> <property name="semanticQuestionDao" > <ref bean="semanticQuestionDao"/...

Spring: Injecting Resource as InputStream into a factory-method

Hi, I want to use anti-samy from OWASP. They got a Policy object, that is instantiated via a factory method. public static Policy getInstance(InputStream inputStream); The InputStream that needs to be passed to the factory-method represents the config file for the policy-object. Is it possible to use create a policy bean in an sprin...

Method Interceptor on private methods

Hello, everybody. Here is a question: I have method digest(byte[] data). It should be private, because we really don't need it outside a class, however i'll not die if i make it public, if it helps. The question is: can i somehow attach interceptor to it? The thing is that it is not called like getBean('MyBean').digest(), it is called th...