JBossCache as a second level cache for Hibernate in JBoss 5?

Answering to my own question. It turned out that you cannot use JBoss Cache with 1 if you start i.e. Put hibernate configuration file into deploy folder of the JBoss server.

This happens because mbean does not accept parameters like "hibernate.cache. *" (and that is exactly what exception is about). So my solution is to initialize bernate from java code and get ride of hibernate.xml.

Configuration configuration = new Configuration(); Properties properties = configuration.getProperties(); properties. Put("hibernate.connection. Datasource", "java:/MSSQLDMDS"); properties.

Put("hibernate. Dialect", "org.hibernate.dialect. SQLServerDialect"); properties.

Put("hibernate.transaction. Factory_class", "org.hibernate.transaction. JTATransactionFactory"); properties.

Put("hibernate. Current_session_context_class", "org.hibernate.context. JTASessionContext"); properties.

Put("hibernate.transaction. Manager_lookup_class", "org.hibernate.transaction. JBossTransactionManagerLookup"); properties.

Put("hibernate.cache. Use_second_level_cache", "true"); properties. Put("hibernate.cache.

Use_query_cache", "false"); properties. Put("hibernate.cache.region. Factory_class", "org.hibernate.cache.

Jbc2. JndiMultiplexedJBossCacheRegionFactory"); properties. Put("hibernate.cache.region.

Jbc2. Cachefactory", "java:CacheManager"); properties. Put("hibernate.cache.region.

Jbc2.cfg. Entity", "mvcc-entity"); File mappings = get configuration. AddDirectory(mappings); sessionFactory = configuration.

BuildSessionFactory().

After some investigation I managed to start bernate+JBossCache with this configuration. Java:/MSSQLDMDS org.hibernate.dialect. SQLServerDialect create true false org.hibernate.cache.

Jbc2. JndiMultiplexedJBossCacheRegionFactory java:CacheManager jboss. Cache:service=CacheManager jboss:service=Naming jboss:service=TransactionManager However, I'm still can not specify (getting the same error) following parameters: "hibernate.cache.region.

Jbc2.cfg. Entity", "hibernate.cache.region. Jbc2.cfg.

Collection", "hibernate.cache.region. Jbc2.cfg. Query".

Without specifying this parameters I can not control what cache instance will be used for caching entries, collections and queries.

Yury Litvinov, those properties are new properties that haven't been mapped to hibernate MBean attributes because the bernate MBean is no longer maintained. I wouldn't recommend that you deploy .

I've had a look at this and have come to the conclusion that the JBoss AS mechanism for parsing and deploying a hibernate.cfg. Xml file is overly fragile and prone to falling out of date with respect to configuration options that I've opened https://jira.jboss. Org/jira/browse/JBAS-7411 with a suggestion of a possible way to improve this.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions