mvc 1 « JPA « Spring Q&A





1. How to reuse a Criteria object with hibernate?    stackoverflow.com

I'm trying to do query result pagination with hibernate and displaytag, and Hibernate DetachedCriteria objects are doing their best to stand in the way. Let me explain... The easiest way to do ...

2. Spring MVC, generating a form backing object from a request?    stackoverflow.com

I am using Spring MVC 2.5, and I am trying to get a JSTL form object to load from a GET request. I have Hibernate POJOs as my backing objects. There is ...

3. Hibernate: lazy-loading doesn't work on one-to-many mapping on set    stackoverflow.com

I'm using Spring together with Hibernate for developing a Portlet for the Liferay portal server. I now have basically two entities, A and B, where A possibly contains many B's. So ...

4. Spring + JPA (Hibernate) on Glassfish --> ClassVisitor problem    stackoverflow.com

I'm trying to write a simple web app with Spring 2.5 (core + MVC) and JPA (using Hibernate for the persistence mechanism). Every time I deploy, I'm getting a "Class ...

5. Hibernate + Spring using multiple datasources?    stackoverflow.com

I'm working on a web application that uses Spring MVC 2.5 and Hibernate. One of the requirements of the application is that it must be able to export some objects to an ...

6. Fixing Null EntityManger in Spring MVC application?    stackoverflow.com

In the following code I am trouble with my injected EnitityManager, which always shows up as null;

public class GenericController extends AbstractController {

    @PersistenceContext(unitName = "GenericPU")
    ...

7. Error 500: Filter [Spring OpenEntityManagerInViewFilter]: could not be loaded    stackoverflow.com

I am trying to deploy a Spring application on WAS 6.0 (JDK 1.4.2). Day back I was getting tons of (Unsupported major.minor version 49.0) errors. I replaced most of the jar ...

8. Spring MVC Domain Object handling Best Practice    stackoverflow.com

Lets assume a simple Spring MVC Controller that receives the ID of a domain object. The Controller should call a service that should do something with that domain object. Where do ...

9. jdbctemplate, jpatemplate    stackoverflow.com

in my dao, in each method, when i call jdbctemplate, i should call with new jdbctemplate(). right? or get one static instant of jdbctemplate and reuse ? how about jpatemplate? ...





10. flushmode can only used one time?    stackoverflow.com

Inside my applicationContext, I have 2 dao . if i assign my 2nd dao below to use flushmode, i will get error invalid; nested exception is org.xml.sax.SAXParseException: Attribute value "org.springframework.orm.hibernate3.HibernateAccessor.FLUSH_COMMIT" ...

11. Decoupling backing store with Spring Web MVC    stackoverflow.com

This is a design pattern question, so I'll illustrate it with a simple example of an address book app. Firstly a few assumptions. 1. It appears to be acceptable to directly use DB ...

12. In Grails GSP, what is the equivalent to Spring MVC's ?    stackoverflow.com

I'm coming from a Spring MVC background on a new Grails app. I have an object that contains a list of dependent objects. On the create and edit screen, ...

13. What other libraries or tools would you add to a Spring/Hibernate stack for improved rapid application development?    stackoverflow.com

My team at work maintains a fairly large webapp written on top of Spring and Hibernate. We're about to start making some fairly large scale changes to the site, and ...

14. spring hibernate: save form object in relation    stackoverflow.com

i have table users: relation many-to-many with table role, groups i use hibernate to map with my class;

<hibernate-mapping package="cbs.domain">
    <class name="User" table="users">
    <id name="id" column="id">
  ...

15. spring mvc: select tag    stackoverflow.com

i have 2 table:

message(id, name, content, channel_number) // channel_number is foreign key
channel(number, name) // number is primary key
i use hibernate to map 2 table java class
public class Message {

 private Integer id;
 ...

16. Spring form handling, mapping an entity to form inputs    stackoverflow.com

Just looking at the petclinic sample application, and trying to learn form handling. It seems the form maps to an entity 1:1 correct? Is there any other configuration that has to ...





17. Glassfish ThreadDeath issue on redploy with Spring MVC and hibernate    stackoverflow.com

I have a spring MVC application that is deployed on a glassfish server. During execution of this application I get a ThreadDeath exception. The exception occurs on the first form submission ...

18. Spring MVC + Hibernate encoding problem    stackoverflow.com

I work on Spring MVC + Hibernate application, use MySQL (ver. 5.0.51a) with the InnoDB engine. The problem appears when I am sending a form with cyrillic characters. As the result, database contains ...

19. Creating a form that doesn't map to an entity    stackoverflow.com

Using spring MVC, how would I create a form that doesn't map to a entity (i.e. it has properties from multiple entities). I want to also validate and use their 'results' object ...

20. database design to speed up hibernate querying of large dataset    stackoverflow.com

I currently have the below tables representing a bus network mapped in hibernate, accessed from a Spring MVC based bus route planner I'm trying to make my route planner application perform ...

21. JPA IndirectSet changes not reflected in Spring frontend    stackoverflow.com

EDIT: Solved, but I don't know what was different now. If anyone can explain what happened differently, I'd appreciate it. The way it's working now is by merging only the Parent, not ...

22. How easy would it be to refactor a small JSP/Servlet/JDBC project to SpringMVC/Hibernate    stackoverflow.com

With reference to this post, I am considering starting a new web-based Java project. Since I don't know Spring/Hibernate I was concerned if it's a bad plan to start learning ...

23. Redirect to show ModelAndView from another Controller - (Spring 3 MVC, Hibernate 3)?    stackoverflow.com

How exactly can I trigger display of a model and view from another model and view’s controller? HTTP Request View --> HttpRequestController POST -> new HttpResponse POJO and a string of the ...

24. NetBeans generates JpaController with errors    stackoverflow.com

I am using NetBeans 6.8 for building Spring MVC application. Technologies :

  • Spring MVC 2.5
  • Derby DB
  • Hibernate for ORM
  • GlassFish v3 server
I use New JPA Controller Classes from Entity Classes for adding ORM file. ...

25. Sping-Hibernate question    stackoverflow.com

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 ...

26. Using Hibernate with Spring 3    stackoverflow.com

My current web development tool is Spring 3, I've used Hibernate before, I'm actually quite familiar with it after I have access to the annotations and entities, and the session object. ...

27. i am using spring for hibernate only not as spring mvc and i am using jsf2.0 and now i need to implement AOP    stackoverflow.com

Possible Duplicate:
How to implement AOP with Spring
i am using spring for hibernate only not as spring mvc and i am using jsf2.0 and now ...

28. Spring 3 MVC + MySQL: cannot store € character    stackoverflow.com

I have Spring 3 MVC set up with Hibernate and MySQL 5. In a web form, I enter a single character into a field, € (i.e. just the one character). When ...

29. Spring - mvc ( SimpleFormController ) with hibernate database insertion    stackoverflow.com

I have made one example , In which I have used Spring - mvc and hibernate. I have successfully insert data in the database table but after that I have refresh ...

30. Steps to use hibernate in a spring 3 mvc application    stackoverflow.com

Can someone outline the steps required to get hibernate working with spring mvc. I've seen EntityDao's that basically inherit from a GenericDAo. The generic Dao has basic operations like GetAll, GetByID, Save, Delete, ...

31. UserDao is null, I am wiring the bean wrong and need help    stackoverflow.com

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 ...

32. Hibernate JPA, Spring MVC and LazyInitializationException    stackoverflow.com

When trying to get items from db, I got this error:

13:00:13.876 [7838526@qtp-204712603-0] ERROR o.h.LazyInitializationException - failed to lazily initialize a collection of role: bo.myobj, no session or session was closed
org.hibernate.LazyInitializationException: failed ...

33. Infinite Recursion with Jackson JSON and Hibernate JPA issue    stackoverflow.com

When trying to convert a JPA object that has a bi-directional association into JSON, I keep getting

org.codehaus.jackson.map.JsonMappingException: Infinite recursion (StackOverflowError)
All I found is this thread which basically concludes ...

34. How to pass Java Date object to dojo DateTextBox through Spring MVC and back to Java?    stackoverflow.com

I wonder how can I pass a Java Date object from beans --> hibernate --> Spring MVC --> dojo and back to that Date object that would be stored in the ...

35. problem in posting data from client side to server side in OnetoOneMapping    stackoverflow.com

In Spring MVC when I submit data from my form then the exception occurs as given below. The situation is like I have Entity class and I have taken another Entity in ...

36. spring mvc 3.0 caching    stackoverflow.com

I'm using spring mvc 3.0 with eclipselink and jpa and I'm experiencing following issue: I have this field in my app:

@OneToMany(mappedBy = "stadium")
private Set<FootballMatch> footballMatches = new HashSet<FootballMatch>();
when there is triggered ...

37. problem in posting data in one to one mapping    stackoverflow.com

i am experiencing problem when my form post data to save to database by jpa where i have used one to one mapping to a class. the there is exception occurs ...

38. Product creation doesn't work (under Spring MVC with JPA)    stackoverflow.com

Well, the code is working under the Test Enviroment, but not on the front context of the application. This is driving me crazy to be honest. Here is the controller:

package org.admios.nuevoproyecto.controller;

import java.util.List;
import ...

39. update table using spring mvc web and hibernate    stackoverflow.com

I have simple spring mvc web application which can handle simple book store. I have a problem when the existing book is updating. I want to up date title of a book. My ...

40. Different classloaders cause ClassCastException when persisting data via Spring    stackoverflow.com

I'm creating an MVC Spring webapp. Using: Jetty (servlet container), DataNucleus (dao platform), DB4O (embedded datastore). When I persist an object (done from within a Spring Controller) using JDO from DataNucleus, it ...

41. spring web MVC and hibernate setup - how to get a hold of your hibernate bean?    stackoverflow.com

I am new to Spring and the bean concept, so sorry if asking the obviously. I have set up a Java project and used the Hibernate framework to make my connections to ...

42. Hibernate aggregates + Spring MVC    stackoverflow.com

I am using Hibernate with my Spring MVC project. Lets say my model has 2 objects each linked to Oracle tables, respectively USERS (USERID, NAME) and USERMONEYDATA (CATEGORY, USERID, AMOUNT) My users ...

43. How to store model information in spring mvc with hibernate    stackoverflow.com

I need advice how to store model in spring mvc 3 with HIbernate (example on ilustration) I have model

public class Customer{
        int id;
   ...

44. Building Application with Spring MVC/Hibernate using HibernateTransactionManager    stackoverflow.com

As far as I understand it's not recommended to use HibernateTemplate in Spring. So what I'm trying to to is to write it using HibernateTransactionManager: What I did so far is Database ...

45. HibernateTransactionManager error in Spring MVC    stackoverflow.com

HI, I'm trying to add user to to Database from Spring MVC controller. and I'm getting the following exception:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.HibernateException: No Hibernate Session bound ...

46. Spring setters/ getters and Mutable Variables    stackoverflow.com

Let's propose that I have the following class

    Public MyClass{

    Date date;

    //Mutable getters and setters

    public Date getdate(){
 ...

47. How to use several databases with Spring MVC and Hibernate?    stackoverflow.com

For example I have one class mapped to a table in first database and the second class mapped to a table in the second database. I would like to use them simultaneously ...

48. Data Retrieval is not in the given order?    stackoverflow.com

greetings all i am using spring framework and hibernate to communicate with database i have a table that contain some records suppose with ids 1,2,3,4,5 when i tried to make an HQL query to ...

49. What is the best way to get a json object from the web controller?    stackoverflow.com

I am doing a web site using spring mvc framework. I want to do a call ajax and receive a json object directly from my web controller. What is the best way/manner/plugin to ...

50. Submit a form in Spring    stackoverflow.com

I have a small application with a table and a form, nothing fancy. I want to be able to click on one specific row and delete/modify the information. I managed to ...

51. Where can i find a good tutorial for integrating hibernate with spring mvc 3.0 using anotations?    stackoverflow.com

Im developing a dynamic website using jsp & spring mvc 3.0 and i can't get hibernate to work with it. Also, Im using postgresql as my database. I dont know which ...

52. In Spring MVC 3.0.5 controller JPA entity not getting persisted to the database    stackoverflow.com

In the code below, persist() returns w/o an exception but the entity is not stored in the database.

@RequestMapping(method = RequestMethod.POST)
public String form() {
       ...

53. how to solve lazyinitializationexception not using fetch=FetchType.EAGER?    stackoverflow.com

Iam still getting the exception lazyinitializationexception. Yes, i know that it means, that the session is closed while I or something else is trying to access the collection. No, the OpenEntityManagerInViewFilter did ...

54. Open source project using Spring     stackoverflow.com

I have gained some knowledge on Spring[Spring in Action] & Hibernate(through google) and want to apply the same to a Open source project so that i can learn how it is ...

55. Retry after Spring throws DataAccessException not working    stackoverflow.com

I am facing a very peculiar situation. I am using hibernate template with spring 3.0.5 for DB operations. When I try to insert a User model the first time, a DataAccessException ...

56. Get Dialect within some class inside Spring MVC + Hibernate application    stackoverflow.com

I have Hibernate Transaction manager configured inside Spring MVC controller.

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
  <property name="driverClassName" value="org.postgresql.Driver" />
  <property name="url" value="jdbc:postgresql://127.0.0.1/doolloop2" />
  <property name="username" value="doolloop2" />
  ...

57. Strange Jackson exception being thrown when serializing Hibernate object    stackoverflow.com

Jackson is throwing a weird exception that I don't know how to fix. I'm using Spring, Hibernate and Jackson. I have already considered that lazy-loading is causing the problem, but I have ...

58. LazyInitializationException by using Spring MVC with AJAX / JSON & MappingJackson    stackoverflow.com

I am using Spring MVC, AJAX/JSON and Hibernate to get all persons from a MySQL database. I wrote JUnit integration tests to verify my service and all is okay. Now I call it ...

59. ModelAndView and byte[] within Sping MVC controller    stackoverflow.com

I have a following mapping which retrieves some "scene" details and shows it inside jsp page.

 @RequestMapping(value="/{id}",method = RequestMethod.GET)
     public ModelAndView showScene(@PathVariable String id){
    ...

60. Java Spring MVC uploading file as byte[]    stackoverflow.com

I have the following problem. I have a ActiveX control written in C++/CLI, which I'm using on client side. one of the control method return binary file by fixed chunk size ...

61. Hibernate query caching types    stackoverflow.com

In my Spring MVC application which retrieves objects from database, I need to cache my queries with the following criteria: 1) there will be five objects which should be persistent in cache ...

62. Adding Spring Framework to existing JSP/EJB application    stackoverflow.com

I had an existing application developed in JSP and EJB 2.1 years ago. Now i want to enhance the application with new features. Is there a way to use Spring and ...

63. Proper use of getHibernateTemplate() in Spring MVC app?    stackoverflow.com

I have a bunch of Hibernate mapped objects in my Spring MVC app. Default seems to be lazy loading for nested objects with relations. I realized this by getting a lot ...

64. Annotated Class in Hibernate    stackoverflow.com

I am still trying my way around the Hibernate for some time now and I do think that I could make use of this framework rather than the hardcore JDBC approach. It ...

65. Spring-Hibernate: How to define default values when using related objects    stackoverflow.com

I have a Spring 3 MVC app sing Hibernate as ORM. All works fine. But a question: I have a web interface to create new objects, say a new CUSTOMER. Each CUSTOMER ...

66. Spring MVC or WebFlow for this project    stackoverflow.com

I have to create an application with Flex 4 with Swiz (MVC Framework) as the UI Layer, Spring (MVC or Web Flow) as the Business Layer, Oracle 10g as Data layer, Hibernate as ...

67. What is the common solution for multiple datasources?    stackoverflow.com

Greetings all In my spring application I will need to use hibernate with two different databases (PostgreSQL & MySQL) and I am not pretty good with configuration, so I need some ...

68. problem with using two datasources with hibernate?    stackoverflow.com

greeting all I tried to use two different datasources with hibernate (two different sessionFactories and two different transactionManagers ) but I got the application failed to start it stops in the step of

Creating ...

69. Can we write describe table query in JPQL?    stackoverflow.com

I am taking a 'Keyword' and table name from user. Now, I want to find all the columns of table whose data type is varchar(String). Then I will create query which will compare ...

70. createSQLQuery to HQL    stackoverflow.com

First of all I am new to spring MVC and hibernate. My senior has told me that in our project they have used createSQLQuery to fire sql at many places, now ...

71. Any online tutorial/example for using hibernate with spring MVC    stackoverflow.com

Is there any online tutorial/example or project which shows how to implement hibernate with spring MVC

72. JPA: What is the efficient way of merging detached object?    stackoverflow.com

Technologies: Spring, Hibernate, JSR-303, JQuery
Platform: Windows I am trying to implement a simple update use case. Please see DAO/Service/Controller Source Code Link Class2 contains many properties including Class1. The Class2Controller ...

73. Any spring MVC sample app using hibernate , DI , AOP    stackoverflow.com

I installed spring petcare example for spring 3 but that looks very simple to petcare clinic. but i am not able to find petclinic for spring 3. Is there any other sample ...

74. org.hibernate.HibernateException: /hibernate.cfg.xml not found    stackoverflow.com

im trying to use hibernate with spring 3 mvc but at the moment i get thrown this exception. i think i need to define my hibernate.cfg,xml somewhere but not sure where? i ...

75. Spring Hibernate form:form beans and null IDs    stackoverflow.com

I'm just wondering if there is a way to have null IDs for persisted beans... When they're just new for example. I'm using Spring and Hibernate. Before, I was using another ...

76. Hibernate Composite Table and Key Issues    stackoverflow.com

I am trying to get hibernate to work with a composite table. Basically there is a users table, roles table, and a composite table called userroles which connects both. ...

77. Can i replace the JDBC logic with hibernate afterwards    stackoverflow.com

I am building a website with spring MVC. As I am new to Java EE, I'm finding it difficult to apply everything at once. So, is it possible that I can ...

78. want to pop out some values from mysql database using hibernate    stackoverflow.com

i have a table that is self joined to itself. i want that when i pop out this table using a self join query it will pop out data till it got ...

79. Hibernate unable to find identifier while saving Entity object to database    stackoverflow.com

I am adding a command object of type Employee to ModelAndView in my spring-mvc+hibernate app. The jsp has a simple form which will be used in 2 ways. 1) To create ...

80. How do I specify the value for a key of a map in the path attribute of < form:input> tag?    stackoverflow.com

My command object has a map of objects .I want to retrieve the keys in this map and use those keys to display the respective value on my jsp page which ...

81. Recommendation System for a book store application    stackoverflow.com

Hey I'm trying to learn some of the recommendation algorithms that's being used in websites like Amazon.com. So I have this simple java (spring hibernate postgres) book store application where in ...

82. Getting added with composite id in show form    stackoverflow.com

My User.hbm file is like this ,

<composite-id>
    <key-property name="username" type="java.lang.String">
        <column name="USERNAME"></column>
    </key-property>
    <key-property name="location" ...

83. How hard is to make shoppping cart with HIbernate annotaion    stackoverflow.com

I am learning spring mvc and hibernate. i have just finished simple site with CRUD operation usin hibernate annotations and mysql. Now i have to build shopping cart site and i don't ...

84. How did spring MVC send data to Model Obj with hibernate    stackoverflow.com

I have

class Person  {

@OneToMany(cascade = CascadeType.ALL)
 @JoinTable(name = "person_countries", joinColumns = { @JoinColumn(name = "person_id") }, 
         inverseJoinColumns = { @JoinColumn(name ...

85. INFORMATION_SCHEMA doesn't exists error while creating EntityManager (JPA + SPRING + H2)    stackoverflow.com

I have a problem with JPA (OpenJPA) + Spring (Web Flow using Spring Web MVC) + H2 database engine. I've got simple RegisterDAO for my simple web application. I am using ...

86. spring mvc hibernate performance issues    stackoverflow.com

We are working on a spring mvc project with hibernate. When we execute the following code:

try {
    HibernateTemplate ht = new HibernateTemplate(sf);
    List<Route> r = ht.findByNamedParam("select ...

87. Spring+JPA Netbeans deployment problem    stackoverflow.com

Greetings, I have a web application that uses spring and JPA. logs tell me everything is running fine. However, I used Netbeans to create this application and so am using it ...

88. Basic question about ComplexPhraseQueryParser    stackoverflow.com

I would like to implement for my website a fuzzy phrase search using Hibernate Search. I've read from some people that ComplexPhraseQueryParser is ok for this. But the thing is that ...

89. What is other alternative to use spring bean without wiring    stackoverflow.com

I am using this in my UserDAO and hibernate

@Resource(name="sessionFactory");
public SessionFactory sessionFactory;
For some reason i am not able to link spring beans in my userDAO from 2 different classes. What is the other ...

90. ehCache and Spring MVC Error with HIbernate    stackoverflow.com

I keep getting this error while setting up ehcache in Spring MVC.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.googlecode.ehcache.annotations.config.internalEhCacheEvictionTask': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: net.sf.ehcache.CacheManager.getName()Ljava/lang/String;
Below is my setup, ...

91. ehCache and Spring MVC Error with HIbernate    stackoverflow.com

I am trying to get caching working on a Service layer method, but it still goes into it and calls the database. Is my setup wrong?

@Cacheable(cacheName="apiActivitiesCache", keyGenerator = @KeyGenerator (
 ...

92. Invalid object name 'ACCOUNT_orders'? Spring-MVC Hibernate with annotation question    stackoverflow.com

I am new to Hibernate. I have Order and Account table in DB,

CREATE TABLE [dbo].[ORDERS](
    [PRICE] [decimal](12, 2) NULL,
    [ORDERID] [int] IDENTITY(0,1) NOT NULL,
  ...

93. How do return a list with Hibernate search on one col?    stackoverflow.com

I had the following code sample that returns a list of friends from my database use Hibernate and it works get but I know change the function to pass in String ...

94. Springs SimpleJdbcInsert doesn't produce auto-generated keys as expected    stackoverflow.com

I'm using springs SimpleJdbcInsert to execute an JDBC insert and return 2 auto-generated keys. The command I use is:

KeyHolder keys = insert.withTableName("TRANSACTION").usingGeneratedKeyColumns("TRANSACTIONID", "ROWID").executeAndReturnKeyHolder(params);
But keys only contains one key named SCOPE_IDENTITY() The logs seem ...

95. How do I add database pooling - Spring3, Hibernate, MySQL    stackoverflow.com

Spring3, Hibernate, MySQL: I am working on my first project, can some one please show me how to change the following code to add database pooling? thanks applicationContext-security-JDBC.xml

<beans:bean class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    ...

96. maven + spring mvc 3 + jpa + hibernate + ehcache    stackoverflow.com

I am getting the following exception when I run my sample project in embedded jetty inside maven.

org.hibernate.cache.NoCachingEnabledException: Second-level cache is not enabled for usage [hibernate.cache.use_second_level_cache | hibernate.cache.use_query_cache]
    at ...

97. Spring3, Hibernate; how do I use HibernateTemplate    stackoverflow.com

I am trying to change the following code to use: HibernateTemplate but cant it working

public List<Friend> listFriends(String rUser) 
{
    hibernateTemplate = new HibernateTemplate(sessionFactory);

    Friend friend ...

98. How can I connect a mySQL database file by using JSP in Spring MVC?(Also Hibernate used.)    stackoverflow.com

Do you advice any tutorial or example?

99. spring JPA incrementally save an entity    stackoverflow.com

I am trying to persist an entity incrementally. Here is an overview of the Entity class


package aop.web.teacher.rmodels;
// Generated 11 Feb, 2011 3:57:41 PM by Hibernate Tools 3.2.2.GA


import java.util.Date;

import java.util.HashSet;

import java.util.Set;

import javax.persistence.CascadeType;

import javax.persistence.Column;

import ...

100. Fetching Entities from DB in a PropertyEditor    stackoverflow.com

When using PropertyEditors with Spring MVC is it bad to have them fetch entities from the database? Should I instead create an empty entity and set its Id. For instance for the ...