Questions tagged [hibernate-generic-dao]

31 questions
0
votes
0 answers

How to mock executeNamedQuery(query, params) for Junit Testing

@Repository public class DAOImpl extends GenericDaoImpl implements SomeDAO { @Autowired EntityManager em; @Override public List getProperties(String env) throws Exception{ List inParam = new ArrayList<>(); …
0
votes
1 answer

Error inserting second datasource with GenericDAO

Error inserting second datasource with GenericDAO I'm trying to insert a second base in persistence.xml. I have already configured the datasource in jboss and tested it. When inserting a second persistence-unit in xml and attempting to raise jboss…
cpll
  • 157
  • 2
  • 10
0
votes
2 answers

NullPointerException hibernate Generic Dao with Spring

i have a bussiness logic class that try to use a dao method save from a generic Dao this is the code from the bl. public void setUsuario(Usuario usuario) { this.usuario = usuario; usuarioDao.save(usuario); } Debugging i found out that user…
0
votes
2 answers

Generic DAO, Spring, Hibernate

I want to understand how can i implement the generic methods like add, edit, delete and search on my database, i have already made the connection (hibernate) and works fine I do have this method, that works Class: GenericDAO public T save(final…
NiB
  • 801
  • 1
  • 9
  • 26
0
votes
1 answer

How to create dynamic bean within different classes in Spring MVC

I need to create dynamic beans at runtime with different classes for different conditions using a dynamic bean factory. It's for generic DAO Implementation.How to implement it using Java configuration?? MVC Initializer Class Using prototype bean…
0
votes
1 answer

Mapping error retrieving data from DB using Hibernate

I have the below entity class: @Entity @Table(name="TB_CUSTOMER") public class Customer { .... I also have the following hibernate.cfg.xml :
YevgenyL
  • 281
  • 3
  • 20
0
votes
0 answers

DAO design and implement practice

For example, I have many tables, such as people car house and so forth, I want to know a good practice for the general DAO design. In this case, people have cars and houses. car and house have it own id, maybe an auto_increment int value. and they…
NingLee
  • 1,477
  • 2
  • 17
  • 26
0
votes
2 answers

How Dynamic Cast Apply in HAS-A Relationship

I want to call both class A Method and Class B method each after. these two class relationship defined as "HAS-A" Relationship.... class A{ public void getData(){ System.out.println("Class A"); } } class B{ public void…
Dhaval Shah
  • 23
  • 1
  • 5
0
votes
1 answer

Spring can not set dao bean in controller

I'm trying to inject a dao-bean in my controller from spring MVC. I'm using the generic dao pattern for the dao-objects. For an unknown reason I receive this error: org.springframework.beans.factory.BeanCreationException: Error creating bean with…
0
votes
1 answer

Get current object ID in Generic DAO. Hibernate

I want to delete all objects by their IDs in Hibernate Generic Dao implementation. For now I created method like this: @Override public void deleteByIds(Collection ids) { getSession() .createQuery("delete…
WelcomeTo
  • 19,843
  • 53
  • 170
  • 286
0
votes
1 answer

Generic DAO - "Never go full generic!"

Ive seen allot of usages of generic dao over the internet. you gotta love it: public interface GenericDao {} public class GenericDaoHibernateImpl implements GenericDao a new class…
Urbanleg
  • 6,252
  • 16
  • 76
  • 139
0
votes
2 answers

Loading data from a table in a Map as Column Name Vs Value using Hibernate

I have been using Hibernate for a while and this time I am trying to do something uncoventional here. Not even sure of its possible. What I want to do is to load data from a Single table, where in few of this columns will have fields defined for…
Salman A. Kagzi
  • 3,833
  • 13
  • 45
  • 64
0
votes
1 answer

Mapping List in hibernate - ClassCastException

I am having difficulties mapping a list in hibernate. I would like to know what you think of my classes, mapping and database scheme. If everything is right, I would appreciate some help on the thrown exception. Thanks in advance ! I have the…
0
votes
2 answers

Spring MVC + Hibernate DAOs : unable to wire beans

I'm currently working on a Spring MVC project in which I integrated Hibernate. The pure Spring MVC part (DispatcherServlet + request mapping) works fine. Now, the problem I have to cope with is quite strange : I've read "Java Persistence with…
kyiu
  • 1,926
  • 1
  • 24
  • 30
0
votes
1 answer

Service methods without using hibernate template

I have been googling for several hour now trying to find an example on how to write a service method that doesn't use Springs Hibernate Template while using a DAO interface. Something that is also confusing me is what happens when I put the…
dlinx90
  • 855
  • 4
  • 14
  • 24