- This topic has 6 replies, 2 voices, and was last updated 18 years, 8 months ago by Haris Peco.
-
AuthorPosts
-
dsurberMemberThe following line of code is maked as a compilation error.
return getHibernateTemplate().load(Foo.class, new Long(id));
The error is
The type net.sf.hibernate.LockMode cannot be resolved. It is indirectly referenced from required .class files
I’m using JDK 1.5, Spring 1.2, and Hibernate 3. My build path includes only the Spring 1.2 ORM/DAO/Hibernate3 libraries. It does not include the Spring 1.2 ORM/DAO/Hibernate2 libraries. Lots of Hibernate 3 code runs. I haven’t yet run any Spring tests because this DAO won’t compile.
Seems like the Spring Hibernate3 lib directly or indirectly includes a reference to a Hibernate2 class.
I found one forum post that seems to describe a related bug.
http://www.myeclipseide.com/modules.php?op=modload&name=PNphpBB2&file=viewtopic&t=10475
Douglas
*** Date: Sat May 13 19:28:01 PDT 2006
*** System properties:
OS=Windows2000
OS version=5.0
Java version=1.5.0_06*** MyEclipse details:
MyEclipse Enterprise WorkbenchVersion: 4.1.1 GA
Build id: 20060309-4.1.1-GA*** Eclipse details:
Eclipse SDKVersion: 3.1.2
Build id: M20060118-1600Eclipse Platform
Version: 3.1.2
Build id: M20060118-1600Eclipse RCP
Version: 3.1.2
Build id: M20060118-1600Eclipse Java Development Tools
Version: 3.1.2
Build id: M20060118-1600Eclipse Plug-in Development Environment
Version: 3.1.2
Build id: M20060118-1600Eclipse Project SDK
Version: 3.1.2
Build id: M20060118-1600Eclipse startup command=-os
win32
-ws
win32
-arch
x86
-launcher
C:\Program Files\eclipse\eclipse.exe
-name
Eclipse
-showsplash
600
-exitdata
964_48
-vm
C:\WINNT\system32\javaw.exe
dsurberMemberI found the problem. When Eclipse resolved the import of the type HibernateTemplate, it resolved it as org.springframework.orm.hibernate.support.HibernateTemplate. This is incorrect. It should be resolved as org.springframework.orm.hibernate3.support.HibernateTemplate.
Seems that even though I thought I was only loading support for Hibernate3, I also got some of the Hibernate2 stuff as well.
Haris PecoMemberdsurber,
check your project build path if you have included hibernate2 libraries – this features work fine except you include hibernate2 libraries
Best
dsurberMemberLooking at File>Properties>Java Build Path>Libraries the only libraries that mention Hibernate are
Hibernate 3.0 Core Libraries
Spring 1.2 ORM/DAO/Hibernate3 LibrariesIf I click Add Library… and select MyEclipse Libraries I see
Spring 1.2 ORM/DAO/Hibernate2 libraries
unchecked. I’m pretty sure I have only the Hibernate3 support included in my build pathy.
Haris PecoMemberDouglas,
spring hibernate jar contents both classes
org.springframework.orm.hibernate.support.HibernateTemplate and
org.springframework.orm.hibernate3.support.HibernateTemplate
but MyEclipse will create DAO with hibernate3Have you created DAO in same project which have correct Hibernate3 libraries ?
Please, can you send your DAO class (with imports) ?
Thanks
dsurberMemberMy DAO class is working now. I understand the problem. The only issue is that Eclipse chose to import .hibernate3. instead of .hibernate2. Now that I know what is happening I can deal with it. Given that I selected Spring hibernate3 and specifically did not include hibernate2 I would expect that the hibernate2 support would not be visible, but it appears not. That seems like a bug to me, but not a major one.
Haris PecoMemberDouglas,
Spring jar contents both hibenrate DAO template and if you make DAO with MyEclipse then
MyEclipse will import correct template (it will be hibernate3 when you choose hibernate3 libraries)
If you make own DAO you have to choose correct template (Eclipse’s ‘organize import’ will offer both, but firts hibernate2)
It is possible resolve only if we change spring libraries, but it can introduce compatiblility problems
It’s imporant that you understand problem and you can care about thisThanks
-
AuthorPosts