I have some big entities which are frequently accessed in the same session. For example, in my application there is a reporting page which consist of dynamically generated chart images. For each chart image on this page, the client makes requests to corresponding controller and the controller generates images using some entities.
I can ...
Hello,
I add entity to my database and it works fine. But when i retrieve the List, i get the old entity, the new entities i add are not shown until i undeploy the application and redeploy it again. This means are my entities cached by default? But, I haven't made any settings for caching entities in my persistence.xml or any such file.
...
Given example from Hibernate docs and modifying it so that root level entity (Customer) is read-only while one of its collections (tickets) is read-write:
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public class Customer {
...
@OneToMany(...)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public Sor...
This question is best described by a picture I think. I hope someone can help me. Thanks
...
I have a simple unit test where I execute the same NHibernate named query 2 times (different session each time) with the identical parameter. It's a simple int parameter, and since my query is a named query I assume these 2 calls are identical and the results should be cached.
In fact, I can see in my log that the results ARE being cac...
We have 2 java web apps both are read/write and 3 standalone java read/write applications (one loads questions via email, one processes an xml feed, one sends email to subscribers) all use hibernate and share a common code base.
The problem we have recently come across is that questions loaded via email sometimes overwrite questions cre...
What is second level cache in hibernate ?
...
In my grails application, I want to display all the current entries of the second-level cache from all regions.
My code is as following :
def getCacheStats() {
StatisticsImpl stats = sessionFactory.statistics
for (regionName in stats.secondLevelCacheRegionNames) {
log.debug stats.getSecondLevelCacheStatistics(regionName).entrie...
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 hibernate 3.2.4 ).
Here's the scenario:
parent object P is cached and is an entity.
Parent has a collection (bag) of children which are cached and lazy.
Children objects C...
Modern database provide caching support. Most of the ORM frameworks cache retrieved data too. Why this duplication is necessary?
...
Our Java application has about 100 classes mapped to a database (SQL Server or MySQL). We are using Hibernate as our ORM (with XML mapping files).
We specify FOREIGN KEY constraints in our database schema. Most of our FOREIGN KEY constraints also specify ON DELETE CASCADE.
We've recently started enabling Hibernate 2nd level caching (fo...
All my references are configured to be lazy loaded like this:
References(x => x.SomeProperty).ReadOnly().LazyLoad();
Everything works fine. Proxies are created. Now I added the following line in each entity mapping class:
Cache.ReadWrite();
and enabled L2 cache like this:
var fluentConfiguration = Fluently.Configure().Database(MsS...
We have a Java application that uses MySQL, Hibernate (3.5.1-Final) and EHcache(1.2.3) for our 2nd level cache.
Our hibernate.properties isolation level is Read-committed isolation = 2
# 2-Read committed isolation
hibernate.connection.isolation=2
Under a high number of concurrent transactions, we're seeing an issue where certain col...
I'm writing a soap web service: Jboss + Hibernate + Java. Database on PostrgreSQL. After publishing the webservice, it runs perfectly.
For testing purposes I change data on the database by opening pgAdmin, and changing the values on the rows by hand. Now, the problem is, Hibernate is not aware of those changes. Not until I re-publish th...
Im currently trying to get hibernate working using the caching provider that comes with hibernate.
net.sf.ehcache.hibernate.SingletonEhCacheProvider
I have a default cache and a class specific cache enabled in the ecache.xml which is referenced in my hibernate.cfg.xml file. The class/mapping file specific cache is defined to handle u...
Hi All-
I defined a second level cache in my application using @Cache annotation
I am using findById query, as the following:
long id = 4;
Company cmp = companyDAO.findById(id);
Where Company is the object that I get from the DB.
How can I check if the Company object came from the DB or from the cache?
...
If I have this method in object class:
@OneToMany( fetch = FetchType.EAGER,
cascade = { CascadeType.ALL },
mappedBy = "object" )
@org.hibernate.annotations.Cascade(
{org.hibernate.annotations.CascadeType.SAVE_UPDATE})
@Column( nullable = false )
public Set<ObjectEntry> getObjectEntries() {
return this.objectEntries;
}
...
Has anyone used AppFabric for their second level caching?
I know it's to follow the same api as for Velocity (nhibernate.caches.velocity) but wanted to know if anyone already had some production experience of using it and if they knew of any particular tips or problems?
...
I'd like to collect data of L2 cache misses for different cache associativity settings . can anybody tell me how i could change the assocoiativity ?
uSing Ubuntu on x86_64 Intel Core2 duo CPU
...
I'm developing an double-entry accounting system and I need to insert posting records without any gaps in the sequential id. Since all database access will happen through a web application, I'm taking care of id generation using a syncronized static variable:
import org.hibernate.*;
public class JournalService {
private static ...