[Lift] Re: Caching JPA entities and JPA vs Hibernate

2008-10-01 Thread Tim Perrett


> IIRC, it needs to be at the top of the classpath, not under META-INF.

Good god, I must stop working at midnight my apologies! The brain
had obviously ceased functioning at that point!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Caching JPA entities and JPA vs Hibernate

2008-10-01 Thread Martin Ellis

On Tue, Sep 30, 2008 at 11:54 PM, Tim Perrett <[EMAIL PROTECTED]> wrote:

> Having an issue with ehcache.xml being picked up. The docs say that it
> need to be on the classpath - I've tried having it in META-INF, WEB-
> INF/classes/META-INF but yet nothing seems to work. It never gets
> picked up...?
>
> Where can i stick it so that its forced to be read?

IIRC, it needs to be at the top of the classpath, not under META-INF.

Martin

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Caching JPA entities and JPA vs Hibernate

2008-09-30 Thread Tim Perrett

Sorry to drag this thread back up - I only just got back round to it
(its my hobby project)

WARN - No configuration found. Configuring ehcache from ehcache-
failsafe.xml  found in the classpath: jar:file:/Users/timperrett/.m2/
repository/net/sf/ehcache/ehcache/1.5.0/ehcache-1.5.0.jar!/ehcache-
failsafe.xml
WARN - Could not find a specific ehcache configuration for cache named
[com.package.persistence.Domain]; using defaults.
WARN - Could not find a specific ehcache configuration for cache named
[com.package.persistence.Event]; using defaults.
WARN - Could not find a specific ehcache configuration for cache named
[com.package.persistence.Theme]; using defaults.

Having an issue with ehcache.xml being picked up. The docs say that it
need to be on the classpath - I've tried having it in META-INF, WEB-
INF/classes/META-INF but yet nothing seems to work. It never gets
picked up...?

Where can i stick it so that its forced to be read?

Cheers, Tim
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Caching JPA entities and JPA vs Hibernate

2008-09-16 Thread Derek Chen-Becker
Cool. For now I'd say just load it once, although you might want to make
your own object to manage it. You could easily make it a lazy var for now
and turn it into a synchronized def later if you need "flush" behavior.

Derek

On Tue, Sep 16, 2008 at 6:59 AM, Tim Perrett <[EMAIL PROTECTED]> wrote:

>
> Hey Derek,
>
> > You're probably on the right track, although I want to clarify: are the
> > entity and its collections something that won't change often? Do you need
> > transactional views on it (i.e. changes made by one session are
> immediately
> > visible in others)? From your question about caching at Boot it sounds
> like
> > this may be something that never changes or very infrequently. If it's
> > something that never changes then you may be able to just load it in
> Boot,
> > touch the collections (to force the lazy retrieval) and then you never
> need
> > to deal with the "cache" per se anyways.
>
> Bang on - they will barley ever change. Certainly for this phase they
> wont change at all. Later I could build an admin control that flushes
> the cache (or refreshes it etc) I guess. I'll try this in boot and see
> what happens
>
> > As for the Hibernate annotations, the only one that's strictly needed to
> > enable caching is
> >
> > @org.hibernate.annotations.Cache
> >
> > What annotations besides that one are you using, and which ones are
> > causing conflicts? There are quite a few that overlap with the JPA
> > standard annotation, so when I use them I usually make specific
> > imports.
> > There are several good articles out there on how to do this out on the
> web:
> >
> > http://www.gridshore.nl/2008/04/29/using-ehcache-and-verifying-that-i...
> >
> > In particular, it's important to differentiate between the entity
> > cache (enabled with the above annotation) and the query cache. It
> > sounds like you need the former.
>
> Cheers Derek, I'll give it a whirl and let you know how I get on :)
>
> Tim
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Caching JPA entities and JPA vs Hibernate

2008-09-16 Thread Tim Perrett

Hey Derek,

> You're probably on the right track, although I want to clarify: are the
> entity and its collections something that won't change often? Do you need
> transactional views on it (i.e. changes made by one session are immediately
> visible in others)? From your question about caching at Boot it sounds like
> this may be something that never changes or very infrequently. If it's
> something that never changes then you may be able to just load it in Boot,
> touch the collections (to force the lazy retrieval) and then you never need
> to deal with the "cache" per se anyways.

Bang on - they will barley ever change. Certainly for this phase they
wont change at all. Later I could build an admin control that flushes
the cache (or refreshes it etc) I guess. I'll try this in boot and see
what happens

> As for the Hibernate annotations, the only one that's strictly needed to
> enable caching is
>
> @org.hibernate.annotations.Cache
>
> What annotations besides that one are you using, and which ones are
> causing conflicts? There are quite a few that overlap with the JPA
> standard annotation, so when I use them I usually make specific
> imports.
> There are several good articles out there on how to do this out on the web:
>
> http://www.gridshore.nl/2008/04/29/using-ehcache-and-verifying-that-i...
>
> In particular, it's important to differentiate between the entity
> cache (enabled with the above annotation) and the query cache. It
> sounds like you need the former.

Cheers Derek, I'll give it a whirl and let you know how I get on :)

Tim
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Caching JPA entities and JPA vs Hibernate

2008-09-16 Thread Derek Chen-Becker
You're probably on the right track, although I want to clarify: are the
entity and its collections something that won't change often? Do you need
transactional views on it (i.e. changes made by one session are immediately
visible in others)? From your question about caching at Boot it sounds like
this may be something that never changes or very infrequently. If it's
something that never changes then you may be able to just load it in Boot,
touch the collections (to force the lazy retrieval) and then you never need
to deal with the "cache" per se anyways.

As for the Hibernate annotations, the only one that's strictly needed to
enable caching is

@org.hibernate.annotations.Cache

What annotations besides that one are you using, and which ones are
causing conflicts? There are quite a few that overlap with the JPA
standard annotation, so when I use them I usually make specific
imports.
There are several good articles out there on how to do this out on the web:

http://www.gridshore.nl/2008/04/29/using-ehcache-and-verifying-that-it-works-with-jpa-and-springframework/

In particular, it's important to differentiate between the entity
cache (enabled with the above annotation) and the query cache. It
sounds like you need the former.

Derek

On Mon, Sep 15, 2008 at 4:20 PM, Tim Perrett <[EMAIL PROTECTED]> wrote:


> Hey guys,
>
> Thanks for your replies. I had a play around with the caching today
> and appeared to be getting a whole bunch of conflicts with
> org.hibernate.annotations, however these might be resolvable either by
> using limited imports to just scrape through with the annotations I
> need, or somehow do it with the orm.xml
>
> Im actually needed to cache an entity that has two collections of
> entities (and those collections have zero subsequent collections); I
> think a second level cache is appropriate but im not 100% on how to go
> about configuring it. Am I on the right path here?
>
> Effectively, the entity and the collections i want to cache are used
> on a request basis so i want to cache them in order to reduce database
> load so im working along the lines that the in memory cache will be an
> order of magnitude quicker to read from than the DB.
>
> Lift wise, where should i be looking to load the entities into the
> cache - from boot perhaps? Its also unclear how it actually does the
> cache (well, i know it stores the dehydrated object), but i mean its
> not like you actually have to manually tell the cache to load up the
> data so when does it actually do the cache itself? (and how can i
> validate its gone in there?)
>
> Cheers for any pointers
>
> Tim
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---