Questions tagged [hibernate-generic-dao]

31 questions
43
votes
2 answers

How to reload Spring Security Principal after updating in Hibernate?

This must be a common issue... and I feel that after googling, and SOing I must have just not looked around thoroughly for the answer enough or that no1 has asked it... so please forgive me. I am using Spring Security with Hibernate etc. So a…
alwinc
  • 1,317
  • 3
  • 14
  • 21
3
votes
3 answers

NullPointerException at org.hibernate.impl.SessionFactoryImpl.getClassMetadata

Not sure how to even phrase this because I am not certain what is null. I have an hbm.xml file configured like this: `
user626607
2
votes
2 answers

Obtaining EntityManager without Spring

I'm using hibernate but not Spring, and just found hibernate-generic-dao. The concept seems nice, but when I run it I get a NPE because I haven't called setEntityManager(). How do I obtain an EntityManager without using Spring?
ripper234
  • 222,824
  • 274
  • 634
  • 905
2
votes
1 answer

Strategy for manage Hibernate Session

I develop a java web app using Hibernate. Here are some code : hibernate.cfg.xml org.hibernate.dialect.MySQLDialect
CodeMonster
  • 300
  • 5
  • 19
2
votes
1 answer

Spring 3, Hibernate 4 AutoWired sessionFactory with Generic DAO

Using Spring MVC 3 & Hibernate 4 I'm…
Daniel
  • 3,017
  • 12
  • 44
  • 61
2
votes
2 answers

getCurrentSession() vs openSession()

I'm trying to use generic-dao (http://code.google.com/p/hibernate-generic-dao/ ). However, in my HibernateBaseDAO the getSession() method is implemented as sessionFactory.getCurrentSession(). This leads to an error for any entity update…
obh
  • 334
  • 4
  • 10
1
vote
2 answers

Hibernate generic DAO search

I'm using the hibernate generic dao project. I need to search for all records where the 'date1' field is earlier than 'date2', something like: search.addFilterLessThan('date1', 'date2'); However it seems from the API that the search only accepts…
Alex
  • 1,041
  • 3
  • 14
  • 32
1
vote
3 answers

Generic Dao, service layer and multiple matching beans

I'm writing a Spring MVC 3.2.3 and Hibernate 4.2.1 application, just starting it's architecture. I decided to go with the Generic Dao pattern, since I'll be using a lot of common CRUD operations. I know that JPA has been around for a while, but I'd…
Emilio
  • 75
  • 2
  • 5
1
vote
2 answers

Issue with Autowiring + genericDAO pattern in spring

In my application I am using generic DAO pattern. My class structure looks like this: A domain class - pojo package com.test.abc.def; @NamedQueries({------a couple of queries go here .......}) @Entity @Table(name = "NAME") public class Name…
user811433
  • 3,999
  • 13
  • 53
  • 76
1
vote
0 answers

Exposing DAO's (in Struts2 based apps.) through WS

How can i design a Web Services which will expose already developed hibernate entity classes in Struts2 base application? Third party application is to do CRUD operation,how can i use the same Hibernate classes to do the CRUD through web services?
Mukthi
  • 561
  • 4
  • 13
  • 35
1
vote
2 answers

Generic DAO and nested properties support

I am trying to perform a DB access through a DAO object, and I have bumped into the case where I need to query a field in another Entity. Considering two entities (EntityA and EntityB) that are connected in entity A through the foreign key…
nuno
  • 1,771
  • 1
  • 19
  • 48
1
vote
1 answer

General or specific DAO to record delivery with information from multiple tables?

I am creating a web application that lets the user store and retrieve information from a DB through a GUI using spring and hibernate. I have gotten stuck when it comes to creating the DAO and service layer. I want to create a method that can add a…
dlinx90
  • 855
  • 4
  • 14
  • 24
0
votes
2 answers

A simple Dao integration test not working

This is a very simple test about persisting a transient Person Object in the database and then verifying that the object saved in the database is the same as the transient Person object. Here goes the…
tintin
  • 5,676
  • 15
  • 68
  • 97
0
votes
0 answers

How can I have multiple ways of generating rawId in spring for an entitiy in hibernate?

I have a situation of doing dual writes where I want to first save the object to a microservice, retrieve the rawId and then save it in the monolith as well. Upon doing application.setId(rawId) I get optimistic locking failure exception . This whole…
0
votes
1 answer

Generic DAO search with group by / unqiue

I am using hibernate-generic-dao for a searching function. Since I only need to show one of the records if they have same value on a column field. But I am not sure how to achieve this by the search / filter functions. package…
1
2 3