spring

Hibernate - setProjection after Criteria after Criteria

why is this not possible? Criteria crit1 = sess.createCriteria(Criteria1Class.class); Criteria crit2 = crit1.createCriteria("criteria2Class"); crit2.setProjection(Projections.groupProperty("criteria2Property")); List<String> l2 = crit2.list(); If I use this construction I get the error: could not resolve property: criteria2Property...

Load objects before action, and share those objects in action and freemaker modules, possible?

Say a logged in user hits the url: www.example.com/forum/234 Before the spring mvc action fires, I want to load the User Object, the user's permission, the Forum object. Now I want to share these objects accross this request. So other classes can look to see, in the current request, for a User, Permission and Forum object. Potentia...

Is there any way to load an application context using a custom BeanWrapper implementation

I would like to be able to use Spring using setter injection into Scala components. Unfortunately, Scala's native setters are named differently from than the JavaBeans standard, foo_= rather than setFoo. Scala does provide a couple of workarounds for this, annotations which force the creation of JavaBeans setters/getters as well as nat...

What maven artifacts do I need for spring hibernate and mysql support?

I have a IDEA project using maven2. I want to use hibernate + mysql, what dependancies do I need? ...

Need hibernate properties for mysql

I can't seem to find an example of hibernate properties for mysql. Is there a link that has an example? I have one for hsql: <!-- Hibernate SessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> ...

Spring and Mixing SQL and NoSQL db

The answers to my previous post encouraged me mixing SQL and NoSQL db. What is the best practice implementation of two databases in terms of application context configuration and DAO creation? Let's choose Derby as the SQL db and Cassandra as the other one. What I am searching for is e.g. an example appcontext.xml, two DAOs, one imple...

Hibernate symbols @id @column are not recognized

In my User class, I'm trying to add the symbols @id and @column. I'm getting a compile error: cannot find symbol class id/column. I'm using IDEA. In the docs, I don't see any reference for @Id and @Column: http://docs.jboss.org/hibernate/stable/annotations/api/ I have this in my pom.xml: <dependencies> <dependency> ...

How to filter a particular class when i have a inheritance ?

Hi, I have this code : class A { String name } class B extends A{ } class C extends A{ } class D{ A a } D d = new D(); d.a = new B() D d2 = new D(); d.a = new C() My query : D.createCriteria().list(...){ A{ eq "a","test" } } But in my result I would have only the element matching with B class not C class. Is it p...

configure spring to use my CM dbpool so I can inject the persistenceContext in my dao

background: I am using geronimo + hibernate + spring. Just using the JPA api's on an EJB backend that contains no servlets, no web.xml. I've been working on this for literally 41 days and have tried all types of combinations so now I'm asking on StackOverflow for help. Please bare with me I have not slept. I have a geronimo managed...

Specifying Group for Bean Validation with SimpleFormController

I'm working with an older spring project that's using the SimpleFormController. It was easy to switch in the beanvalidation.LocalValidatorFactoryBean validator bean to look at the annotations on the command object, but I can't see how I would override one of the methods to enable the validator to look at a specified group of validation r...

listing vaules in spring

I am doing following List list=new ArrayList(); list.add(new String[] {"1","java"}); model.addAttribute("tagList", list); And in view <form:select path="probTag"> <form:options items="${tagList}" itemLabel="${tagList[0]}" itemValue="${tagList[1]}"/> </form:select> but this is not working. What else can be done to solve the prob...

name attribute in bean for sessionFactory is in 'red' in IDEA i.e. cannot resolve property

My app-config.xml looks like: <!-- Hibernate SessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <!--<property name="configL...

Spring configs for webapps -> location in WEB-INF mandatory?

Hi all I have just finished building my up from bottom (database) over DAO and business layer. Now I am getting warm with the presentation layer for which I chose Spring MVC. I have checked out the example delivered with spring-webflow-samples/booking-mvc. I was wondering why all spring configs are located in webapp/WEB-INF/config rat...

UserDao is null, I am wiring the bean wrong and need help

My homecontroller has a UserService object that gets wired using spring correctly (it renders the index page just fine using a method no UserService). Now I setup hibernate, so inside UserService I have a UserDao object that I am trying to wire using spring. @Service public class UserServiceImpl implements UserService{ UserDao use...

How to set content type for emails sent using spring's JavaMailSenderImpl

Hi, question is from subject. I'm using JavaMailSenderImpl from spring 3.0.3.RELEASE and velocity 1.6.4 for mail preparation from template. When I send email with Croatian characters from my webapp recipient receives "?" in stand of normal Croatian characters. If I turn debug mode for mails, from log I can see that Content-type is ...

Spring's ContentLoaderListener not found in the web-app but was found on the system classpath

I am building a GWT app with Spring. I am having some issues to inject a dependency to one of my Servlets, so I am trying to narrow down what can be wrong. First, when my app starts I get: [WARN] Server class 'org.springframework.web.context.ContextLoaderListener' could not be found in the web app, but was found on the system ...

Understanding the SessionFactory in Spring

A little background: I'm using Spring and Hibernate to create a really simple domain/dao/service structure. I'm also using Autowiring to inject all my beans into their happy places. While refactoring, I recently got the all-too-popular error message "could not initialize proxy - no Session" when trying to access a FetchType.LAZY prope...

Could not autowire field, but I have the definition

My app-config.xml has a definition for my UserDao bean: <bean id="userDao" class="com.blah.core.db.hibernate.UserDaoImpl"> <property name="sessionFactory" ref="sessionFactory"/> </bean> I have my component scanning: <context:component-scan base-package="com.blah" /> My index action in my HomeController works fine (it ...

What mysql driver do I use with spring/hibernate?

Little confused, is 'driverclassname' and 'hibernate.dialect' both referring to the mysql driver? What should I be using? Is the connectorJ the one I should use? <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="org.hsqldb.jdbcDriver"/> ...

Spring Validation Annotations Order

Hi, I want to ask is it possible to set explicitly the validation order in Spring. I mean, I have this command object: public class UserData { @NotBlank private String newPassword; @NotBlank private String confirmPassword; @Email(applyIf="email is not blank") @NotBlank private String email; @NotBlank private String firstNam...