collection « Cache « JPA Q&A





1. Hibernate second level cache - When can stale collection members be returned from the second level cache?    stackoverflow.com

A colleague of mine and I have been having a debate as to when (if?) a collection cached in the second level cache can return stale data (we're using ehcache and ...

2. cache collection in hibernate    stackoverflow.com

I have Company object and

@OneToMany(fetch = FetchType.EAGER, cascade = { CascadeType.ALL }, mappedBy = "company")
@Column(nullable = false)
Set<User> getUsers()
Do you recommend caching the getUsers collection performance wise?

3. Rolling back and 2nd level collection cache    stackoverflow.com

I have Hibernate with 2nd level cache provided by Ehcache. I have Parent and Child classes, with Parent.children cached collection. When I execute the following code:

Session session = DataSessionFactory.openSession();
Transaction tx = session.beginTransaction();
Parent parent ...

4. Hibernate collection caching problems    stackoverflow.com

I have the following 2 Hibernate entites:

@Entity
@Table(name = "VEHICLE_BRAND")
public class VehicleBrand implements java.io.Serializable {

  ...

  @Column(name = "NAME", nullable = false, length = 1000)
  public String getName() {
 ...

5. Trouble caching collections with Hibernate and EhCache    stackoverflow.com

as the topic suggests, I'm having some trouble with Hibernate and EhCache. I'm using Hibernate with mySql and EhCache in a Resteasy-application. The model: There are a few entities, some are one-to-many and ...

7. Second cache level, collections from user interface, jpa    forum.hibernate.org

Hello, My question is about invalidation of the second cache level in jpa implementation (and hibernate). I have an object which is coming from my client (ajax). This object contains a collection which has been modified in the client side. When the object returns from the client side, I reattach it by calling merge() on it. All items of the collection ...

8. Cannot cache an unknown collection    forum.hibernate.org

Hibernate version: 3.3.1 Hello, while starting some webapp on jboss, hiberante throw me this error. I have absolutely no idea where it comes from, less how to solve it: Code: jvm 1 | 14:13:12,326 INFO [STDOUT] 14:13:12,322 ERROR [ContextLoader] Context initialization failed jvm 1 | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ...

9. Caching: Many objects with collections point to the same row    forum.hibernate.org

Hey folks, I've got a bit of a performance problem, and I'm wondering if I can somehow configuring hibernate's caching or fetching to work with me better. Our database has a table with a column that holds a huge xml file that contains the configuration for the entire system (not my design). Many objects in the database have collections (Sets) mapped ...





10. Caching collections, enumerations.    forum.hibernate.org

Hi all, I use to Ehcache as second level cache provider. Everything look great, but... For one collection hibernate always hit the database, other collections work correctly. Hibernate version 3.2.7.ga. Entity from collection: Code: @Entity @Table(name = "TD_TABLE") @SequenceGenerator(name = "SEQUENCE_GENERATOR", sequenceName = "SEQ_TABLE") @Proxy(lazy = false) @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = Region.REGION_RW) public class MyClass extends SomeClass { ...

11. Using EHCache with collections of an object    forum.hibernate.org

Hi all, ehCache seems really good, I am seeing some great performances improvements. So far I have only used it for discrete objects. However, if I have objects Foo and Bar, and they each have a cache defined in ehcache.xml, and Foo has a collection of Bar's, do I also need to have the cache foo.bars defined as well? I assume ...

12. Ehcache Question and Collection Question    forum.hibernate.org

Hi alls, I'm using 2.1rc from CVS and Ehcache provider. I have such class Code: /** * @hibernate.class table="feedback_category" * mutable="true" dynamic-update="true" * @hibernate.jcs-cache usage="read-write" */ public class FeedbackCategory { ..... /** * @return * @hibernate.bag inverse="true" * table="feedback_category" * lazy="false" * cascade="all" ...

13. What is the right way for specifying collection-cache?    forum.hibernate.org

Use a person class as an example, ...... ...... I would like to use the tag in the Hibernate configuration file, what would be the correct format for the name value? ...... ...... Is it "Person.accounts"? TIA

14. No caching of collection    forum.hibernate.org

I have two clasess with a 1 to many relation. Every time the object with the collection is loaded, then the collection elements are read from the database ( i have show_sql turned on). The object is only read from the database after the time to live period have expired. Both classes uses read-write cache. I would expect the collection elements ...

15.  and     forum.hibernate.org

Hello, In User manual (on-line version from Hibernate site), on chapter 12.2.1, is is written: "Alternatively (preferrably?), you may specify and elements in hibernate.cfg.xml." The strange part is the the DTD (on-line version from Hibernate site), the elements and do not exits. So, what is with these two elements? Are they implemented in the latest stable release ...

16. cache object with collections    forum.hibernate.org

Hi I am having problem to cache a object graph. the object mapping like the following:





17. Caching collections    forum.hibernate.org

I have a Group object which contains a Set of Question objects. Each Question object in turn has a Set of Answer objects. I have a query that returns a Group object with its Set of Question objects and each Question with its Set of Answer objects. I want to cache the results but I can't get it working. I have ...

18. EHCache statistics collection    forum.hibernate.org

19. 2nd level cache collections    forum.hibernate.org

Hi, i'v got two classes Author and Work, with a one-to-many relation. Both Author and Work are . Author a = (Author) session.load(Author.class, id); Set works = a.getWorks(); Repeated exectution of this code show that only author instance is read from the cache, but not works instances, through everyting's read-only. What am i doing wrong? thanks.

20. Collection caching    forum.hibernate.org

Quick question about the second level cache and collections. If I have a collection that is cached (by the second level cache) and I add a new item to the collection using Session.save() will the second level cache pick it up? From my testing it seems that the cache needs to expire before the new object get's picked up. Is that ...

21. Caching object w/ collections    forum.hibernate.org

Is there any way to have Hibernate cache an entire object, complete with its collections, in a single cache? Rather than having a cache for the base object, association, child object, etc. We use a distributed replicated cache and having child objects potentially partitioned across 6 servers may be a huge performance hit. Would like to retrieve the entire object graph ...

22. Garbage collection hibernate cache    forum.hibernate.org

I am curious how hibernate handles the following: It loads objectA from the session, loads a list with objects (including objectA), the list is removed in the running environment, thus only keeping a reference to objectA. The objects from the list except objectA are garbage collected by java. How does this reflect to the hibernate cache? Does it keep the objects ...

23. second-level cache / collections behavior / node not found    forum.hibernate.org

I have a question about the behavior of the second level cache and collections. I am using JBossCache 1.2. I am testing the caching of collections. The parent object is not cached during this test. When the object is saved to the database I am seeing this error message in the JBoss Log after the parent and collection rows have been ...

24. ehCache and caching collections    forum.hibernate.org

Hibernate 2.1.7: class ResourceSchedule { Long objOid; (primary key) Long resourceOid; (foreign key) Date startTime; Date endTime; String ScheduleType; } I would like to use ehCache to handle read/write caching on some very small (but often occuring) transactions. More specifically, I have a collection of resource schedules that relate to a table that currently is going into a hash map, with ...

25. second level cache / collection-cache problem    forum.hibernate.org

Newbie Joined: Fri May 20, 2005 2:42 am Posts: 14 Hello, i have a question concerning the second level cache and caching collections. I have a business object that has a list of security Objects. In the first step i want to load all security Objects into the second level cache, which works fine. The objects are stored in the second ...

26. Session Cache not tracking collection objects?    forum.hibernate.org

Problem Definition: Inside the same session, it seems that when I persist a collection object outside of it's parent, the parent object will not include it in a subsequent request. However, if another session is opened then the additional object is retrieved. Is this a known limitation of the session cache? Hibernate version: 3 Name and version of the database you ...

27. Cache collection of the top level object    forum.hibernate.org

Is it possible to create a collection cache of the top level object. For example: I have a top level object Cat that coincides with db table cat_tbl. I need to create a cached collection of Cats with certain predicate (cats of a certain bread). I want this collection to be updated when ever new cats objects are added or updated, ...

28. Collections are not getting cached.    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp [b]The problem we are facing is very straight forward but we are not able to find the solution of the problem. The cache we are using is EHCache. The collections we are using in our hibernate class is getting cached.[/b] [b]Scenario:[/b] We have a product class which maps to the product ...

29. Evicting a collection from hibernate second level cache    forum.hibernate.org

Hi, I have a hibernate object containing a collection(set) of child objects. Both the object and the collection are cached(second-level cache). I would like to evict the object as well as its collection from cache. I tried out the evict() method on the object but it did NOT evict the collection. It only evicted the parent object. I have cascade="all-delete-orphan" on ...

30. Problem with collection cache.    forum.hibernate.org

31. Collection Caching    forum.hibernate.org

Hi all, I am quite new to ehcache, so excuse me if my question sounds stupid. I am using ehcache1.1 with hibernate2.x. I am having caching problems when using 2L cache. Say I have a Department object which has a set of Employees. Assume the Department object has been cached. My problem is the following: When I add a new Employee, ...

32. collection cache does not work    forum.hibernate.org

View unanswered posts | View active topics Board index Hibernate & Java Persistence Hibernate Users All times are UTC - 5 hours [ DST ] collection cache does not work Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message sreepraveen_2000 Post subject: collection cache ...

33. Does hibernate differentiate between collections for caching    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: Hibernate version 3.0 Name and version of the database you are using: Oracle 9i Does hibernate differentiate in using second level cache if the collection is Hashset or Sortedset (Having a sort attribute with value as comparator class in the mapping file for element set). In my application I ...

34. Placing arbitrary collections in the second-level cache    forum.hibernate.org

As far as I can tell, Hibernate is great at putting three kinds of objects into the second-level cache. 1. Mapped entities 2. Collections of the above that are mapped as one-to-many or many-to-many relations 3. Query results But is it possible to cache a collection of mapped entities that results from some arbitrary operation? I have a method: Code: public ...

35. how to remove collections refs from cache    forum.hibernate.org

Hi, I am having bit of trouble saving objects (objects contains collection of another objects and hibernate's uuid is used for id) in another hibernate session. (sessions points to different database and objects need different ids in each database) I save objects in one hibernate session then I call: session1.clear(); session1.close(); sessionFactory1.close(); After that I initialize second session factory and opens ...

36. Any strategies for caching large collection on demand?    forum.hibernate.org

Hibernate version: 3.1.x Name and version of the database you are using:Oracle 9x I have a large collection that I can't afford to load into memory. I would say around 100,000 objects in the collection and I have many(100s) of these collections. That collection needs to be pageable as well as sortable in many different ways. The objects gets deleted/updated quite ...

37.  and     forum.hibernate.org

38. Hibernate Session-cache and garbage collection    forum.hibernate.org

Hibernate version:3.x Hi folks, We have a question concerning the Hibernate session-cache in conjunction with garbage collection: After an object is loaded by a session, it is automatically stored in the session-cache. If the application holds no more references to that object, can the cache be garbage collected? That would imply that the cache uses internally weak-references. If not so, we ...

39. Caching collections problem...    forum.hibernate.org

Hi, I have a bidirectional many to one relation from A to B. In the mapping I use a bag for the B side of the association mapped with lazy="false" and inverse="true". Inside the bag mapping I have a to enable caching of the collection: Now, when I retrieve the B side of the association from the database (cache ...

40. second level cache for filtered collection    forum.hibernate.org

41. Hibernate Session Cache and Garbage Collection    forum.hibernate.org

All, I'm using long-lived sessions (to preserve the first level cache) and demarking transactions at each http request cycle. It's an AJAX webapp, so I'm incrementally changing the data and need this long-lived session cache so that my pojos can use java equality for their references, lazy loaded collections and cascade-loaded sub objects. The sessionPerConversation solution works wonderfully and I'd like ...

42. collections getting invalidated from cache for unknown reaso    forum.hibernate.org

Hibernate version: 3.2.1 Using a mix of JPA and hibernate annotations. Hi, I am trying to use 2nd level cache to cache a tree of entities and collections, but only certain collections appear to be caching correctly. I run a Query.list() that it loads the entities I asked for. Immediately after I use the Hibernate.initialize() to initialize the collecitons of the ...

43. Second level caching collections - n+1 problem    forum.hibernate.org

Hello everybody I am Bert and I am part of the team of weewar.com a turn based strategy game. In advance: Hibernate is great. I want to thank the developers and the open source community for creating such a great product. My problem concerns a cached collections. I am using a second level cache (ehcache). All essential mapping documents can be ...

44. Cached collections use separate cached domain objects    forum.hibernate.org

Hey. I'm trying to configure cache in main domain applications and I have a small problem (maybe it is a question). I've looked through entire documentation and other sites with tutorials/explanations how second-level cache works in hibernate, but I've found no answers. Here it is... For example, I have two domain Objects (it's just a simple example, but perfectly describes my ...

45. Collection cache stupidity in Hibernate Core    forum.hibernate.org

Currently, 2-nd level collection caching system is STUPID. Let's look into this method of the class PersistentList: Code: public void initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner) throws HibernateException { Serializable[] array = ( Serializable[] ) disassembled; int size = array.length; ...

46. EHCache fails to restore persist collections from cache    forum.hibernate.org

Newbie Joined: Thu Nov 15, 2007 3:17 am Posts: 19 Hi, im using ECCache as second level cache for hibernate and got some problems with the query cache. Second level cache and query cache is activated for the SessionFactory: Code: hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider hibernate.cache.use_second_level_cache=true hibernate.cache.use_query_cache=true Cache configuration: Code: ...

47. Problem with cached collections after removal of an entitiy    forum.hibernate.org

Hey, following problem( with a cache strategy for all classes and collections): We have two tables mapped to classes PropertyGroupHibData and PropertyHibData. PropertyGroupHibData has a collection to PropertyHibData( Resolves a 1-N Relation). Code: