This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 233570 - [HQL Editor] org.hibernate.AnnotationException: @Temporal should only be set on a java.util.Date or java.util.Calendar property
Summary: [HQL Editor] org.hibernate.AnnotationException: @Temporal should only be set ...
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: Hibernate (show other bugs)
Version: 7.4
Hardware: PC Linux
: P3 normal (vote)
Assignee: Sergey Petrov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-29 07:50 UTC by KrzysiekWu
Modified: 2016-07-07 08:54 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
H4 ant library (105.04 KB, image/png)
2013-07-29 08:48 UTC, KrzysiekWu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description KrzysiekWu 2013-07-29 07:50:22 UTC
Ok, now i want to use joda-time in my domain object. Project compile and run just fine but in the HQL editor there is an error like above. I suppose it is because HQL editor uses Hibernate3, not 4. How to change the default Hibernate version HQL editor uses??

org.hibernate.AnnotationException: @Temporal should only be set on a java.util.Date or java.util.Calendar property: [classpath]
	at org.hibernate.cfg.annotations.SimpleValueBinder.setType(SimpleValueBinder.java:93)
	at org.hibernate.cfg.annotations.PropertyBinder.bind(PropertyBinder.java:118)
	at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1674)
	at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:754)
	at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:534)
	at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:286)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1286)
	at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
Comment 1 KrzysiekWu 2013-07-29 07:57:38 UTC
When I remove @Temporal annotation the error is:


java.lang.VerifyError: (class: org/jadira/usertype/dateandtime/shared/spi/AbstractTimestampColumnMapper, method: getHibernateType signature: ()Lorg/hibernate/type/AbstractStandardBasicType;) Wrong return type in function
	at java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2416)
	at java.lang.Class.getConstructor0(Class.java:2726)
	at java.lang.Class.newInstance0(Class.java:345)
	at java.lang.Class.newInstance(Class.java:327)
	at org.jadira.usertype.dateandtime.shared.spi.AbstractSingleColumnUserType.<init>(AbstractSingleColumnUserType.java:41)
	at org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime.<init>(PersistentLocalDateTime.java:31)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
	at java.lang.Class.newInstance0(Class.java:374)
	at java.lang.Class.newInstance(Class.java:327)
	at org.hibernate.type.CustomType.<init>(CustomType.java:52)
	at org.hibernate.type.TypeFactory.heuristicType(TypeFactory.java:245)
	at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:260)
	at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
	at org.hibernate.mapping.Property.isValid(Property.java:185)
	at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:440)
	at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
	at org.hibernate.cfg.Configuration.validate(Configuration.java:1102)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287)
	at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
	at org.netbeans.modules.hibernate.hqleditor.HQLEditorController.getHibernateSessionFactoryForThisContext(HQLEditorController.java:246)
	at org.netbeans.modules.hibernate.hqleditor.HQLEditorController.processAndConstructSessionFactory(HQLEditorController.java:337)
[catch] at org.netbeans.modules.hibernate.hqleditor.HQLEditorController$1.run(HQLEditorController.java:126)
Comment 2 Sergey Petrov 2013-07-29 08:10:34 UTC
So far, framework is based on hibernate3, in this case hibernate4 feature are not supported by default.

You can try t replace hibernate jars in ant lubraries for hibernate library and see if it works properly or not, but there may be some issues. Also if you will try and will find it as working solution, please provide feedback, it may help to upgrade nb to hb4 fater.
Comment 3 KrzysiekWu 2013-07-29 08:39:27 UTC
Yes, I've replaced hibernate jars for H4 earlier but with no effect. 

Should I also replace Hibernate JPA ant library?
Comment 4 KrzysiekWu 2013-07-29 08:48:06 UTC
Created attachment 137921 [details]
H4 ant library
Comment 5 KrzysiekWu 2013-07-29 11:15:13 UTC
Ok, i've switched back to Hibernate3, remove @Type annotations and in HQL Editor have error "java.lang.NoSuchFieldError:", so now i have to switch back also the ant library... Pain in the ass...

When H4 will be supported?
Comment 6 KrzysiekWu 2013-07-29 15:32:28 UTC
Ech...

Want to have something like HQL Editor with Hibernate4 or/and use Joda-time in it?
Use this small piece of nice code https://github.com/maheskrishnan/HQLRunner/blob/master/HQLRunner.java Thanks man.

Or switch to IntelliJ or Eclipse.

Well, it's a pity...
Comment 7 Sergey Petrov 2013-07-29 20:39:30 UTC
>Should I also replace Hibernate JPA ant library?
yes, may be, this one may be used also.

but it's just an idea.

Also it may have sense to remove hibernate from nb_inst\java\modules\ext\hibernate.
Comment 8 Sergey Petrov 2013-07-29 21:02:14 UTC
>When H4 will be supported?

There are no specific plans, 7.4 already contain latest 3.x instead of absolutely obsolete in previous release, but there may not be enough time to try 4.x in 7.4.
Comment 9 KrzysiekWu 2013-07-29 21:49:50 UTC
>>>Should I also replace Hibernate JPA ant library?
>yes, may be, this one may be used also.

I've replaced all jars except commons and logging. No effect.

>Also it may have sense to remove hibernate from
>nb_inst\java\modules\ext\hibernate.
Ok, i'll try it too

>There are no specific plans, 7.4 already contain latest 3.x instead of
>absolutely obsolete in previous release, but there may not be enough time to
>try 4.x in 7.4.

Ok, I understand it completely - you are doing what you can. Thx for great piece of software anyway.
Comment 10 Sergey Petrov 2013-08-07 09:49:38 UTC
Now I want to wait a bit for hibernate with jpa 2.1 support and try to update bundled and framework with new one hibernate.
Comment 11 Martin Balin 2016-07-07 08:54:52 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss