spring

Spring commits when it should not ? (related to Oracle autocommit)

I have an interface like below public interface FooDAO { public void callA(String x); } and an implementation as below deliberately making readonly true and not supported public class FooDAOImpl implements FooDAO { //for testing @Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED) public void callA(Strin...

Sping-Hibernate question

I have been handed a large Spring-Hibernate project and have been told to go through the code and figure out how it works. I have been able to run the project in JBoss and access pages locally, but I have no idea how to figure out how the program is layed out, as I have no web programming experience. I have been told that it is "pretty...

Would you use Spring for a .net application?

Hi. Would you use Spring for a .net application? It is a big winforms application. I ask this because its been a while since there is any new version of spring. What framework do you use for dependency injection??? Thanks ...

Spring @Controller and Transactionmanager

I'm having a basic Spring Controller package org.foo; @Controller public class HelloWorldController implements IHelloWorldController { @RequestMapping(value = "/b/c/", method = RequestMethod.GET) public void doCriticalStuff(HttpServletRequest request, HttpServletResponse response){ //... } } Tested via curl -X GET htt...

What does SimpleJDBCTemplate.queryForInt do when the database returns null?

What does SimpleJDBCTemplate.queryForInt do when the SQL query's actual result is null? In particular, what happens if I run queryForInt("select max(foo) from f") and f has no rows? While I'm on this subject, what happens if I run queryForInt("select foo from f") and f has no rows? ...

generate service /dao layer for GWT/Spring/Hibernate/PostgreSQL

We're developing a webapp using GWT 2.0(not to AppEngine), Spring and Hibernate and trying to jumpstart by auto-generating as much code as possible. I've looked at http://stackoverflow.com/questions/1963672/spring-roo-vs-appfuse-generate-service-dao-layer. I tried appfuse but that did NOT work for me; Also, roo for GWT is not quite ther...

Difference between configuring data source in persistence.xml and in spring configuration files

I've seen (and done) data source configuration in two ways (the code below is just for demo): 1) configuration inside persistence units, like: <persistence-unit name="LocalDB" transaction-type="RESOURCE_LOCAL"> <class>domain.User</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> <properties> <proper...

Spring @Controller Unittest @RequestMapping

Having a basic Spring Contoller i'd like to Unittest the Request Mapping (not the Method itself), if the doCriticalStuff Method is indeed called package org.foo; @Controller public class HelloWorldController implements IHelloWorldController { @RequestMapping(value = "/b/c/", method = RequestMethod.GET) public void doCriticalStuff...

ant junit task error

i am trying to do the spring tutorials from the spring website. one of the tutorials include bulding an ant build file which when i build I keep getting this error BUILD FAILED build.xml:146: You must not specify nested elements when using refid When i click on the error it seems to be pointing at this location <target name="tests" d...

JPA mapped model returns null elements with Composite-Keys

I have build my data model using JPA and am using Hibernate's EntityManager 3 to access the data. I used HSQLDB for testing (junit). I am using this configuration for other classes and have had no problems. However, the latest batch of tables use a composite-key as the primary-key and I am not able to retrieve the populated row from...

Thread-safe Controller and Utility Classes?

So I'm using Spring MVC and in my controller I call several Utility classes. Do the Collections I use in those utility classes need to be synchronized? Similarly, are multiple threads spawned for each user when they access my webpage in the controller meaning I need to ensure thread-safety? ...

is possible to combine: jersey + jetty + spring

Hi, I'm trying to create a webserver embedding jetty (rather than J2E) , and map my servlets RESTfully, using jersey. I'm using spring for dependency injection, and mapping the servlets as beans However, when I try to make an HTTP req to the mapped servlets, i get error 500- server error, or 404, page not found. I'm not sure if i'm doin...

spring security customize logout handler

How can I add my own logout handler to LogoutFilter in spring-security ? Thanks! ...

How to avoid hard linking Frontend assets In Spring MVC

I am new to spring MVC coming with experience using PHP MVC frameworks and ROR. I am having a hard time finding the appropriate way to organize and include front end assets into the view templates. Here is the default code Roo produces for the default style sheet: <spring:theme code="styleSheet" var="roo_css"/> <spring:url value="/${r...

Options for using Spring, Hibernate, JPA, and Tomcat with multiple Databases

I have a java web app running under Spring 2.5.6, Hibernate 3.4 (with Hibernate as the JPA provider), and Tomcat 6. I have it working with one DB schema / persistence unit but now need to connect to 2 schemas / persistence units. Can I do this without moving to a J2EE container such as JBoss or Glassfish? Will I need to use something lik...

How can i get my CGLIB proxied classes working with spring framework's ReflectionUtils?

I have a cglib proxied class because the impl uses both the @Repository @Transactional annotations. I would like to use spring's reflection utils to set the field value for mocking out one of the fields. But when reflection utils can not find the field in my class. How can i get this to work? So then i can mock out the field (collab...

Get servletcontext for factory class in spring

Hi ..., I want to create Factory Class. for example is FooFactory. before Foo instanced, FooFacoty must be injected ServletContext to the constructor. I have snippet as follows: public class FooFactory() { public static Foo getFoo() { ctx = //getservlet context Foo foo = new Foo(ctx); return foo; }...

Study on Spring Framework: Managed Beans as controller and Dispatcher Servlet as Controller

Currently in study of spring framework. I hope i can understand it properly and I think i need some help. This is spring doc on bean concept. http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html This is spring doc on controller concept http://static.springsource.org/spring/docs/3.0.x/spring-frame...

testing for empty string with SPEL in spring-webflow 2.1

Hi, I have a usecase where I want to set the value of a field which I keep in the session and have added to the . I keep 'myModel' in flowScope Now I would like to set a String property of object myModel if it is empty, so I want to do something like this: <on-render> <evaluate expression="if empty(flowScope.myModel.name)) ...

Spring 3 - How to configure sessions persistence properly ?

I have session persistence configured in Jetty. Simple example with Spring Security and jsp page works fine. Session is restored after server restart, I'm still authenticated. But after using EntityManager and some Spring components I get an axception on startup : java.lang.IllegalStateException: Cannot deserialize BeanFactory with id o...