Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] how to generate history table under the history policy

This is a bug in the query hint, it is parsing the string as a time not
timestamp.
Please log a bug for this and vote for it.  Also include in the bug that the
hint should allow a date-time object.

The bug is in the QueryHintsHandler, using timeFromString instead of
timestampFromString.

As a workaround you can get the EclipseLink DatabaseQuery from the JPA Query
and set the AsOfClause for it.


Joe(Zhou Xiangtao) wrote:
> 
> Thanks for your reply, now I have another question. I use QueryHints.
> AS_OF
> to make a historical query. 
> 
>  When I pass the date as hint parameter,  and look at the sql under
> console,
> the date parameter always is 1970-01-01. Do you have any suggestion?
> 
>  
> 
> Here is the code:
> 
>  
> 
> TypedQuery<Consignee> query=em.createQuery("select c from Consignee c
> where
> c.id=?1", Consignee.class);
> 
>                                 query.setParameter(1, consignee.getId());
> 
>                                 SimpleDateFormat format=new
> SimpleDateFormat("yyyy/MM/dd HH:mm:ss.S");
> 
>                                 System.out.println(format.format(d));
> 
>                                 query.setHint(QueryHints.AS_OF,
> format.format(d));
> 
>                                 query.setHint(QueryHints.MAINTAIN_CACHE,
> false);
> 
>  
> 
>  
> 
> And for your hint, about the Session customer, I didn't find a method to
> get
> the default Table creator,  only table creator has the table definition.
> Could you give more detailed description?
> 
>  
> 
> Regards,
> 
> Joe
> 
>  
> 
>  
> 
> -----Original Message-----
> From: eclipselink-users-bounces@xxxxxxxxxxx
> [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of José Arcángel
> Salazar Delgado
> Sent: Tuesday, October 26, 2010 12:27 AM
> To: EclipseLink User Discussions
> Subject: Re: [eclipselink-users] how to generate history table under the
> history policy
> 
>  
> 
> On Lun 25 Oct 2010 01:46:12 Joe(Zhou Xiangtao) escribió:
> 
>> Hi everyone,
> 
>> 
> 
>> 
> 
>> 
> 
>> What I need is automatically generate history table, there is no 
> 
>> obvious method to achieve this.
> 
> Eclipselink doesn't have any method to automatic created the history
> table.
> 
> You need to manually create every table using some Session customizer.
> 
>> 
> 
>> 
> 
>> 
> 
>> About the JPA history, you can find it here:
> 
>>  <http://wiki.eclipse.org/EclipseLink/Examples/JPA/History>
> http://wiki.eclipse.org/EclipseLink/Examples/JPA/History
> 
>> 
> 
>> 
> 
>> 
> 
>> And about table generation, there is an old mail described it, but 
> 
>> it's not clear, anyone can give a further description or demo code?
> 
>> 
> 
>> 
> 
>> 
> 
>>  <http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg05160.html>
> http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg05160.html
> 
>> 
> 
>> 
> 
>> 
> 
>> regards,
> 
>> 
> 
>> Joe
> 
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://old.nabble.com/how-to-generate-history-table-under-the-history-policy-tp30045218p30067415.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top