Coder Social home page Coder Social logo

generic-dao's People

Contributors

simonlg avatar

Watchers

 avatar

generic-dao's Issues

Howto deal with several persistence units?

EntityManager injected via default persistence unit:

    @PersistenceContext
    public final void setEntityManager(EntityManager entityManager) {
        this.entityManager = entityManager;
    }

Howto deal with several persistence units?

Original issue reported on code.google.com by [email protected] on 21 Aug 2010 at 8:44

GenericDao don't insert

I have:

My DAO Interface:

{{{
public interface UserDao extends IDao<User, Long> {

    void persist(User user);

    User findByLogin(String login);

}
}}}


My DAO Implementation:

{{{
@Repository
@Transactional(readOnly = true)
public class UserDaoImpl extends GenericDao<User, Long> implements UserDao {

    public UserDaoImpl() {
    }

    @SuppressWarnings("unchecked")
    public User findByLogin(String login) {
        List<User> list = findByCriteria(Criteria.forClass(User.class).add(
                Restrictions.eq("login", login)));

        if (list == null || list.size() != 1) {
            return null;
        }

        return list.get(0);

    }
}

}}}

But when i need save in the controller with: userDao.save(user) nothings
happen in the database.


I have using Spring + Spirng MVC + JPA + Hibernate

I need help, thanks you.


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 11 Sep 2009 at 5:10

ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType

-When running VATRManagerTest.findAll() as a JUnit test, I'm getting a
ClassCastException: 
Caused by: java.lang.ClassCastException: java.lang.Class cannot be cast to
java.lang.reflect.ParameterizedType
    at com.szczytowski.genericdao.impl.GenericDao.<init>(GenericDao.java:53)
    at be.fodfin.proto.genericdao.VATRManagerImpl.<init>(VATRManagerImpl.java:11)

-What version of the product are you using? On what operating system?
I'm using genericdao v1.0 on WindowsXP

-Please provide any additional information below.
Eclipse project has been attached.

Original issue reported on code.google.com by [email protected] on 17 May 2010 at 10:29

Attachments:

@Column annotation in getters

I have noticed that findByExample method only take care of annotated fields
but has no effect if the annotations are in getter methods.

Original issue reported on code.google.com by [email protected] on 13 Mar 2008 at 12:46

This is more of a query than a issue.


Hi Guys,

I wanted to post a query, could not find a better place to place this. :)
Your framework will force the users to implement EntityImpl for all the 
entities.
Why is it required? The other similar frameworks like the ones with hibernate 
generic support do not have constraints like this. I would no like to alter my 
existing entities just to use a new framework. Can it not be done without this 
constraint?

Cheers
Sushant
[email protected]


Original issue reported on code.google.com by [email protected] on 14 Jun 2011 at 9:48

findByExemple Doesn't work

What steps will reproduce the problem?
1. Create a method that make a query via findByExample
2. Execute the methode
3. The list return contains the whole table

With an example containing my primary key I expect only one result but I
alway have the whole table.

I'm using Generic DAO 1.0


Here is an example of my way of using it.
UserObject implements IEntity<Long>
UserObjectManager extends IDao<UserObject, Long>
UserObjectManagerImpl extends GenericDao<UserObject, Long> implements
UserObjectManager 

UserObjet userObject = new UserObject();
userObject.setId(new Long(0));

List<UserObject> myList = userObjectManager.findByExample(userObject)

System.out.println("size = "+myList.size());
-> I got 1321;


How do I have to use this method, findByExemple.

if i performe the same query with a criteria it works
findByCriteria(Criteria.forClass(UserObject.class).add(Restrictions.eq("login",
login)))


Please, help

Thanks you

Original issue reported on code.google.com by [email protected] on 6 Nov 2009 at 12:21

Criteria API fails with EclipseLink JPA provider

Given some Java code like:

  Criteria criteria = Criteria.forClass(Projet.class);
  criteria.add(Restrictions.eq("campagne.id", idCampagne));

  DAO.findByCriteria(criteria);

Using EclipseLink JPA provider (I updated the pom.xml), I get this error:

java.lang.IllegalArgumentException: An exception occurred while creating a 
query in EntityManager: 
Exception Description: Syntax error parsing the query [select this from Projet 
as this where this.campagne.id=?], line 0, column -1: unexpected end of query.
Internal Exception: NoViableAltException(-1!=[792:1: 
comparisonExpressionRightOperand returns [Object node] : (n= 
arithmeticExpression | n= nonArithmeticScalarExpression | n= anyOrAllExpression 
);])
    at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1373)
    at com.szczytowski.genericdao.criteria.Criteria.prepareQuery(Criteria.java:333)
    at com.szczytowski.genericdao.criteria.Criteria.list(Criteria.java:236)
    at com.szczytowski.genericdao.impl.GenericDao.findByCriteria(GenericDao.java:319)
[...]


It looks like "select this from Projet as this where this.campagne.id=?" is not 
a valid JPQL query.

AFAIK numbered parameters must be specified with an index, e.g.:
  "select this from Projet as this where this.campagne.id=?1"

Whereas Hibernate HQL doesn't need this index, that's why included tests for 
criteria succeed.

Original issue reported on code.google.com by [email protected] on 27 Jan 2011 at 11:24

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.