What I did was add a BaseEntity from which I create my other entities:
import java.util.Date
import javax.persistence._
/**
The base entity from which audited entities are extended
*/
@MappedSuperclass
class BaseEntity {
@Temporal(TemporalType.TIMESTAMP)
@Column{val name="CREATED_AT",
Happy! Happy! Joy! Joy!
I don't know how I missed this in your email of the 18th. Brain full, I
guess. This works perfectly and it is exactly the way it should be.
Thank you very much.
Chas.
Derek Chen-Becker wrote:
> Bingo :)
>
> On Fri, Oct 24, 2008 at 9:50 AM, Tim Perrett <[EMAIL PROTECTE
Bingo :)
On Fri, Oct 24, 2008 at 9:50 AM, Tim Perrett <[EMAIL PROTECTED]> wrote:
>
> Actually - sorry, im being dull, the annotation marks it for
> invocation doesnt it. Doh.
>
> On Oct 24, 4:49 pm, Tim Perrett <[EMAIL PROTECTED]> wrote:
> > Oh thats really nice - was not aware of those!
> >
> >
Actually - sorry, im being dull, the annotation marks it for
invocation doesnt it. Doh.
On Oct 24, 4:49 pm, Tim Perrett <[EMAIL PROTECTED]> wrote:
> Oh thats really nice - was not aware of those!
>
> One thing thats not clear from that code; how do markCreateTime and
> markUpdateTime get called?
It's a JPA annotation for lifecycle methods. There's a really nice chart
explaining when they get called here:
http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#CHDCHFJJ
Basically, for what Chas wants to do, I'd do something like
//define fields
@Te
Oh thats really nice - was not aware of those!
One thing thats not clear from that code; how do markCreateTime and
markUpdateTime get called? They dont appear to be invoked anywhere?
Cheers, Tim
On Oct 24, 4:40 pm, "Derek Chen-Becker" <[EMAIL PROTECTED]> wrote:
> It's a JPA annotation for life
Of course, that won't prevent whoever uses that class from manually changing
them...
On Fri, Oct 24, 2008 at 9:40 AM, Derek Chen-Becker <[EMAIL PROTECTED]>wrote:
> It's a JPA annotation for lifecycle methods. There's a really nice chart
> explaining when they get called here:
>
>
> http://www.ora
Hey Derek,
Whats @PrePersist - cant say im that familiar with it?
Cheers
Tim
On Oct 24, 4:10 pm, "Derek Chen-Becker" <[EMAIL PROTECTED]> wrote:
> Personally I use the @PrePersist lifecycle method interceptor when I want to
> do things like record dates. Not quite as concise as the Hibernate st
Personally I use the @PrePersist lifecycle method interceptor when I want to
do things like record dates. Not quite as concise as the Hibernate stuff,
but it's more flexible since you control the logic for what gets
set/updated.
Derek
On Fri, Oct 24, 2008 at 5:16 AM, Tim Perrett <[EMAIL PROTECTED
I think you should be able to do this by using an interceptor or event
listener - does this article help:
http://java.dzone.com/articles/using-a-hibernate-interceptor-
If you manage to get the created_on and updated_at stuff working I'd
be interested in how you did it as I think its something we
After migrating from Hibernate 3.0 to 3.3.1 the past 2 weeks I have gained
some hatred towards Hibernate.
I had to write atleast 3 workarounds to Hibernate bugs. No cool at all. :/
I feel your pain,
cheers,
Viktor
On Wed, Oct 22, 2008 at 1:41 AM, Charles F. Munat <[EMAIL PROTECTED]> wrote:
>
>
Nope. Turns out this is a really poorly explained "feature" of Hibernate
(and, in the opinion of many, a really dumb one). My code was correct,
and the problem isn't anything Scala-related. In order for this code to
work, the *database* has to generate the values, e.g. via a trigger,
which I
Yeah, that does look strange. But I actually copied and pasted those
directly out of a book (on Safari). The idea is that these are immutable
to the user. But the Hibernate GeneratedTime of INSERT means Hibernate
sets the value on insert of the record, and ALWAYS that it sets the
value (to the
Yeah, I think you want insertable to be true on the first one (just omit the
insertable val) and on the second one you want to omit both insertable and
updatable to make them both true.
Derek
On Tue, Oct 21, 2008 at 6:00 AM, Viktor Klang <[EMAIL PROTECTED]>wrote:
> But both are updatable false a
But both are updatable false and insertable false?
I might be daft, but that doesn't look good to me...
Cheers
Viktor
On Tue, Oct 21, 2008 at 5:06 AM, Charles F. Munat <[EMAIL PROTECTED]> wrote:
>
> In my Lift app based on the JPA demo I tried this, which should work
> beautifully according to
15 matches
Mail list logo