-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
 Post subject: "java.util.Date" class attribute problem
PostPosted: Mon Feb 18, 2008 3:56 am 
Newbie

Joined: Thu Feb 14, 2008 1:48 pm
Posts: 15
Hi - again... :-)

I have got a little problem with bean classes containing one or more "java.util.Date" attributes. While I defined the accordant classes as @Entity (as you see I am using annotations) hibernate does not even create a database table.
If I remove the attributes of type "java.util.Date" all my problems are blown away - except that I cannot persist my required "java.util.Date"-attributes...

What am I doeing wrong? Any idea? I would appreciate any kind of help.

THX!
EH


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 18, 2008 4:44 am 
Expert
Expert

Joined: Thu Jul 05, 2007 9:38 am
Posts: 287
Have you tried the

@Temporal

Annotation?

_________________
Please rate useful posts.


Schauderhaft: Softwaredevelopment, Projectmanagement, Qualitymanagement and all things "schauderhaft"


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 18, 2008 5:36 am 
Newbie

Joined: Thu Feb 14, 2008 1:48 pm
Posts: 15
@schauder: THX! That seems to be what I need! I will try it out this evening and give a feedback - of course!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 18, 2008 5:47 pm 
Newbie

Joined: Thu Feb 14, 2008 1:48 pm
Posts: 15
I tried:

@Temporal( TemporalType.TIMESTAMP )
private Date start;

That did NOT solve the problem. The table is still only generated without the java.util.Date attributes.

Any further ideas?

THX
EH


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 19, 2008 3:43 am 
Expert
Expert

Joined: Thu Jul 05, 2007 9:38 am
Posts: 287
What database do you use?

I used this on Oracle XE / 10 and MySql (5 I think) ...

_________________
Please rate useful posts.


Schauderhaft: Softwaredevelopment, Projectmanagement, Qualitymanagement and all things "schauderhaft"


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 19, 2008 3:46 am 
Newbie

Joined: Thu Feb 14, 2008 1:48 pm
Posts: 15
I am using the HSQLDB.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 20, 2008 5:28 am 
Newbie

Joined: Thu Feb 14, 2008 1:48 pm
Posts: 15
Folks! Please help me!
I am not able to solve my problem on my own:

Hibernate does not create a table for an entity if the entity-class contains a java.util.Date!

What can I do?!?

THX!
EH


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 20, 2008 12:55 pm 
Expert
Expert

Joined: Thu Jul 05, 2007 9:38 am
Posts: 287
Here is what I would do:
- Make sure you are using java.util.Date and not java.sql.Date
- Create a small but complete example, and post the code here
- Try it on a different database (oracle xe, mysql ...) in order to check if it is a HSQLDB issue or a general one
- If all things fail, get the hibernate source code and debug the construction of the create table statements

Jens

_________________
Please rate useful posts.


Schauderhaft: Softwaredevelopment, Projectmanagement, Qualitymanagement and all things "schauderhaft"


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 20, 2008 5:37 pm 
Newbie

Joined: Thu Feb 14, 2008 1:48 pm
Posts: 15
Okay. Here is the result of what happened:

private java.util.Date start; --> worked
private java.util.Date end; --> failed
private java.util.Date theEnd; --> worked

It seems that "end" is an sql keyword... :-) Okay. It is an sql keyword...

Solved. Thank you.

Greetings,
EH


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.