is hibernate-generic-dao 1.1.0 support hibernate 4.0?

850 views
Skip to first unread message

李 中伟

unread,
Dec 16, 2011, 3:02:40 AM12/16/11
to java-generic-dao
hi
is hibernate-generic-dao 1.1.0 support hibernate 4.0? and if
support ,how to deploy,when i use hibernate 4.0 .it throws no this
method when sessionFactory.getCurrentSession()

David W

unread,
Dec 22, 2011, 9:25:53 PM12/22/11
to java-generic-dao
Has anyone else gotten this to work with Hibernate 4.0? I have to
admit that there is a bit of an architectural error in the framework
that hard-codes it to Hibernate 3.x, but I don't know if it may still
work with v 4.0 or not. Let us know if you have had experience getting
it to work with Hibernate 4.0.

Thanks.

David

David W

unread,
Dec 22, 2011, 9:26:49 PM12/22/11
to java-generic-dao
If everyone has had trouble with this, an issue should probably be
logged in the Google code project.

David

cdomb...@gmail.com

unread,
Feb 27, 2012, 9:59:31 AM2/27/12
to java-gen...@googlegroups.com
There is an issue running against Hibernate4 due to API changes. It looks like the affected methods were deprecated around 3.5 and have now been removed. This is the error that I got:
java.lang.NoSuchMethodError: org.hibernate.metadata.ClassMetadata.getIdentifier(Ljava/lang/Object;Lorg/hibernate/EntityMode;)Ljava/io/Serializable;
    at com.googlecode.genericdao.search.hibernate.HibernateEntityMetadata.getIdValue(HibernateEntityMetadata.java:63)

uri.r...@gmail.com

unread,
Sep 10, 2012, 6:11:51 AM9/10/12
to java-gen...@googlegroups.com, lizh...@gmail.com
Hey,
I just made it work with hibernate 4, by several code changes in the source.
How could I make a contribution to the project with my source?
Best Regards,
Uri Ravzin.

neverm...@vip.qq.com

unread,
Sep 25, 2012, 9:38:15 PM9/25/12
to java-gen...@googlegroups.com, lizh...@gmail.com, uri.r...@gmail.com
I made some changes to the source code and it works. But hibernate4's get metadata's PK has changed,so I can not get the current session, so how you solve the transaction problem?

Uri Ravzin

unread,
Oct 4, 2012, 1:53:37 AM10/4/12
to neverm...@vip.qq.com, java-gen...@googlegroups.com, lizh...@gmail.com
* com.googlecode.genericdao.search.hibernate.HibernateEntityMetadata
Changed method parameters due to hibernate API changes
    * metadata.getIdentifier()
    * metadata.getMappedClass()
    * metadata.getPropertyValue()
* com.googlecode.genericdao.search.hibernate.HibernateNonEntityMetadata
Changed import package for org.hibernate.engine.spi
Message has been deleted

nevermissing

unread,
Jan 4, 2013, 1:17:58 AM1/4/13
to ble...@gmail.com, java-gen...@googlegroups.com, lizh...@gmail.com, uri.r...@gmail.com

generic-dao’s version has not been updated from then on.

 

And generic-dao of version 1.x do not support hibernate v4.x.

 

So if you are using hibernate v4, you need import generic-dao’s source code  and modify it for your own usage.

 

From: ble...@gmail.com [mailto:ble...@gmail.com]
Sent: 02 January 2013 23:41
To: java-gen...@googlegroups.com
Cc: neverm...@vip.qq.com; lizh...@gmail.com; uri.r...@gmail.com
Subject: Re: is hibernate-generic-dao 1.1.0 support hibernate 4.0?

 

Hi,

We currently use generic-dao on our project and would like to migrate to hibernate 4. Before we work on updating generic-dao's sources, is there any version we should start from? I can see a branch was created recently (Oct 28, 2012) but it does not seem that any code was then updated.

Thx,

Fabien Le Bars

bala...@gmail.com

unread,
Jan 31, 2013, 5:25:08 PM1/31/13
to java-gen...@googlegroups.com, lizh...@gmail.com
Seems what is in need of change is HibernateEntityMetadata should do now:
getIdentifier(Object entity, SessionImplementor session);
instead of the old
getIdentifier(object, EntityMode.POJO);

However SessionImplementor I think it's an abstraction to get the hibernate-search as the concrete implementations are FullTextSessionImpl  and SessionImpl/StatelessSessionImpl, but I don't think that you ever inject with Spring the SessionImplementor so we can't just add it as a parameter in the constructor and it's not obtainable from the SessionFactory but rather it contains a SessionFactory.

In the end the IncrediblySillyJpaMapsIdMappedIdentifierValueMarshaller is used to get the id out of session.getPersistenceContext().getEntry( propertyValues[i] ); - session is of type SessionImplementor - so we need that to get the Hibernate PersistenceContext -.

Wow it seems that with hibernate4 JPA we really need to work through a bunch of layers and abstractions, makes you wonder if too much abstraction might not be that good at least not at midgnight.

David W

unread,
Feb 14, 2013, 8:51:31 PM2/14/13
to java-gen...@googlegroups.com, lizh...@gmail.com, bala...@gmail.com
Okay. I'm back from my sabbatical and I'm working on the Hibernate 4 upgrade myself. I thought you added the "IncrediblySIlly" part just for fun, but now I see that it's actually in the Hibernate code base. Wow!

-- David

heshu...@gmail.com

unread,
Feb 15, 2013, 4:55:56 AM2/15/13
to java-gen...@googlegroups.com, bala...@gmail.com
Hi David
I am so glad to hear about that!
now i want to obtain snaptshots from the Maven Repository,actually i can't get it from Maven Center Repository,Can you provide any server address?
thanks in advance
Hugo

David Wolverton

unread,
Feb 15, 2013, 9:56:31 AM2/15/13
to java-gen...@googlegroups.com
See http://code.google.com/p/hibernate-generic-dao/wiki/InstallationAndConfiguration for instructions on snapshot repo. I don't have any snapshots uploaded yet. I'll post when I do.


--
You received this message because you are subscribed to the Google Groups "java-generic-dao" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-generic-d...@googlegroups.com.
To post to this group, send email to java-gen...@googlegroups.com.
Visit this group at http://groups.google.com/group/java-generic-dao?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages