I am getting the error "java.lang.IllegalStateExcepton: Failed to load Application Context" when I am trying to run my unit test from within Eclipse.
The Unit Test itself seems very simple:
package com.mycompany.interactive.cs.isales.ispr.ws.productupgrade;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWit...
I have annotated controller which contains several methinds mapped on urls. Like this:
@Controller
public class CategoryController {
@RequestMapping(value = "/addCategories")
public void addCategories(@RequestParam(value = "data") String jsonData) throws ParseException
@RequestMapping(value = "/getNext")
public void getNext(@RequestPa...
I have encountered a Hibernate issue I just can't find my way around. We're running Hibernate 3.2.6 on JBoss 4.2.0, in a Spring 2.5.4 application behind JBossWS 2.0.1 (just to get all the version on the table).
Normally this works just fine, but sometime the system spontaneously (i.e. for some reason currently not know to us) enters a s...
Hi,
is there some pretty way to check if some specific user (not the one that is logged in) has some specific role?
Here is grails example (generally the same for plain Java but syntax):
def user = User.get(1) //Get user with id 1
if (ifAnyGranted(user,"ROLE_ADMIN")) { //This is the line I need to implement somehow
...
}
Thanks in a...
I'm attempting to learn Spring MVC but have been spoiled by Grails. While I am able to get a basic web application working I was wondering if there were any tools that could do some of the work to create a crud application given a database or hibernate data model? The only one I've found so far is http://www.skywayperspectives.org/portal...
I have a requirement where I need to share some web resources (jsp, html, js, images, css etc.) across different Spring based Struts 2 applications. And seems like OSGi can be used to achieve this?
Can some one give some pointers on how to achieve this with OSGi?
And secondly I want to know is OSGi mature enough to be used in producti...
I wanted to know what the community considers the "best practices" in respect to mapping class hierarchies with Spring JDBC.
We do not have the ability to use a full fledged ORM tool, however we are using the Spring JDBC to alleviate some of the tedious nature of JDBC. One class which we leverage very regularly are the BeanPropertyRo...
Hi,
what I would like to accomplish is the following:
have autocommit enabled so per default all queries get commited
if there is a @Transactional on a method, it overrides the autocommit and encloses all queries into a single transaction, thus overriding the autocommit
if there is a @Transactional method that calls other @Transaction...
Hi,
is there a way to reference a .properties file in a spring-context.xml and a JPA persistence.xml?
I think I've seen somewhere an example of this in spring context files, though I can't remember where that was. Maybe someone knows this?
About the persistence.xml I am actually unsure if this works at all.
My aim is to change some pr...
in my applicationcontext.xml
<bean id="annotatedsessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="packagesToScan" value="testonly.package.model" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect...
Hi. I have a java web application which uses spring webflow as framework. I have a problem with processing data on a plain flow xml. When the processing gets more complicated I find it hard to implement using the flow xml of the web flow. I was considering of using controllers to perform these operations. How do I do this. Have no Idea ...
@Entity
public class Person {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
private int salary;
@Version
private long version;
// ...getters and setters
}
may i know is there required to create set/get for "version" ?
in my code ,when persist (saveorupdate) this entity with hiber...
Is it possible to have one controller to handle multiple forms in spring?
For example, i have 3 steps registration that map with "/register" url. Is it possible to have only one RegisterController that can handle all registration's steps form submit?
...
I have a requirement to have all our properties files be stored in a directory. The location of this directory should be stored in a system environment variable. In my application context I will need to access this environment variable to create the FileSystemResource bean. Here is an example of what I would normally have:
<bean id="pr...
In Spring, is there a way to execute a task after returning a view or I need to create a ThreadPool and do it ?
Ex:
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
Map<Object, Object> data = new HashMap<Object, Object>();
//do some stuff
exe...
Hi. How do I get or pass in the flow xml the value from a selectoneMenu field in an XHTML page.
...
How do I detect and inform the user that they already have an active session and provide them an option to create a new session or close the current active one? Please advise. Thanks much.
...
This is how my entity look like
@Entity
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Table(name = "TestPojoOnly")
@NamedQueries({@NamedQuery(name = "TestPojoOnly.findAll", query = "SELECT h FROM TestPojoOnly h"), @NamedQuery(name = "TestPojoOnly.findById", query = "SELECT h FROM TestPojoOnly h WHERE h.id = :id"), @Na...
I loaded same entity record on 2 separate browser window then press submit (hibernate template.merge), version number incremented for both browser window, but never caught any problem with optimistic lock.. so how to test this?
my save() look like this
hibernatetemplate().merge(..);
setJPAObject(null); //reset after save
...
New to spring, we have a whole pile of validators that generate java warnings, I was able to hide them using the "@SuppressWarnings" annotation, however what is the proper way to sort this out?
public class SignInValidator implements
org.springframework.validation.Validator {
@SuppressWarnings("unchecked")
public boolea...