Caching configuration problem: WARN EhCacheProvider:86

Hello,

I am able to successfully generate ORM code from an ERD with caching disabled as discussed here: http://forums.visual-paradigm.com/posts/list/2212.html

The sample code generated works as expected.

When I enable caching the sample programs function as they should, but produce the following warnings:



19:04:15,656  WARN EhCacheProvider:86 - Could not find configuration [hibernate.test.com.arkadias.idemo.orm.IDemoName]; using defaults.
19:04:15,809  WARN EhCacheProvider:86 - Could not find configuration [hibernate.test.org.hibernate.cache.UpdateTimestampsCache]; using defaults.
19:04:15,812  WARN EhCacheProvider:86 - Could not find configuration [hibernate.test.org.hibernate.cache.StandardQueryCache]; using defaults.

My environment is as follows:

VP-UML Professional Version 6.0 (Build sp2_20070526)

OS: Mac OS X Version 10.4.9 - 2 GB Ram

A step-by-step procedure to reproduce this issue:



===============================================
ORM code generated from ERD

Notes: 
{workspace_dir} is Eclipse workspace, home to all Eclipse projects
  e.g. /Users/glen/Documents/Eclipse/
{project_dir} is the home directory for current project
  e.g. {workspace_dir}/com.arkadias.idemo/
===============================================

1. Create a new Eclipse project

  - Create new project in Eclipse: File/New/Project/Java Project
    - Project name: com.arkadias.idemo
    - Contents: Create new project in workspace
    - JRE: use default JRE...
    - Project layout: Create separate source and output folders
      - {project_dir} is created as: {workspace_dir}/com.arkadias.idemo

2. Install JDBC driver jar

  - Create {project_dir}/lib
  - Copy JDBC driver jar here
  - Add JDBC driver jar to Build Path

3. Create Entity Relationship Diagram

     - Create new ER diagram in VP-UML
     - Assign tables, columns and data types on ERD

4. Create Class diagram from ER diagram

   - Create Class diagram from ER diagram
     - Tools/Object-Relational Mapping (ORM)/Synchronize to Class Diagram
     - Assign <<ORM Persistable>> stereotype as needed
     - Assign package to ORM Class Diagram e.g. com.arkadias.idemo.orm

5. Create database and persistable objects (ORM) from ERD

   - Create database manually (if needed) e.g. database name idemo
   - Generate Code and Database from ERD
     - Tools/Object-Relational Mapping (ORM)/Wizards
       - Welcome page
         - Language: Java
         - Wizards: Generate Code and Database from ERD
       - Class Details Configuration page
         - Package: Leave Blank - VP-UML picks up "com.arkadias.idemo.orm" from Class Diagram
       - Database Configuration page
         - Driver file: {project_dir}/com.arkadias.idemo/lib/com.mysql-connector-java-5.0.4-bin.jar
         - Provide Connection URL and User data as appropriate
         - Confirm Test Connection passes
       - Generate Code page
         - Error Handling: Throw PesistentException
         - Exception Handling: Print to log4j
         - Default Lazy Collection Initialization: Lazy for small data set, Extra for large
         - Mapping Type: Annotation
         - Output Path: {project_dir} e.g. /Users/glen/Documents/Eclipse/com.arkadias.idemo/
         - Deploy to: (as appropriate for target system) e.g. Standalone Application
         - Association Handling: Smart (handles both side of 1 - many updates)
         - Persistent API: Factory Class
         - Generate Criteria: Check (generates criteria (query) objects)
         - Serializable: Check
***      - Cache Options: EHCache
           - With default settings
         - Cache Options/Classes Cache Configuration
           - Name: com.arkadias.idemo.orm.IDemoName
           - Cache: Read-Only
         - Select Optional Jar: (default)
         - Advance Settings: (default)
         - Samples: Samples only (generates ORM usage sample code)
         - Scripts: None
       - Finish to generate Code
       - Add {project_dir}/lib/annotations.jar and orm.jar to Build Path
         
7. Test generated ORM classes

   Sample code execution
   - CreateIDemoData.java            - Perform as expected, but with warning ***
   - DeleteIDemoData.java            - Perform as expected, but with warning ***
   - ListIDemoData.java              - Perform as expected, but with warning ***
   - RetrieveAndUpdateIDemoData.java - Perform as expected, but with warning ***

*** No warning message is displayed with cache disabled

{project_dir}/src/ehcache.xml contains:



<ehcache>
    <diskStore path="java.io.tmpdir"/>
    <defaultCache maxElementsInMemory="10000"
        eternal="false"
        timeToIdleSeconds="120"
        timeToLiveSeconds="120"
        overflowToDisk="true"/>
</ehcache>

Based on information at http://www.developer.com/open/print.php/10930_3559931_4, (see Configuring EHCache) I added custom cache blocks for each warning message:

Could not find configuration [hibernate.test.com.arkadias.idemo.orm.IDemoName]
Could not find configuration [hibernate.test.org.hibernate.cache.UpdateTimestampsCache]
Could not find configuration [hibernate.test.org.hibernate.cache.StandardQueryCache]

That resolved the problem. Everything seems to be working as it should.

The corrected {project_dir}/src/ehcache.xml contains:



<ehcache>
    <diskStore path="java.io.tmpdir"/>
    <defaultCache maxElementsInMemory="10000"
        eternal="false"
        timeToIdleSeconds="120"
        timeToLiveSeconds="120"
        overflowToDisk="true"/>
    <cache name="hibernate.test.com.arkadias.idemo.orm.IDemoName"
        maxElementsInMemory="10000"
        eternal="false"
        timeToIdleSeconds="120"
        timeToLiveSeconds="120"
        overflowToDisk="true"/>
    <cache name="hibernate.test.org.hibernate.cache.UpdateTimestampsCache" 
        maxElementsInMemory="10000"
        eternal="false"
        timeToIdleSeconds="120"
        timeToLiveSeconds="120"
        overflowToDisk="true"/>
    <cache name="hibernate.test.org.hibernate.cache.StandardQueryCache" 
        maxElementsInMemory="10000"
        eternal="false"
        timeToIdleSeconds="120"
        timeToLiveSeconds="120"
        overflowToDisk="true"/>
</ehcache>

It would be nice to add this extended configuration of ehcache.xml as the default produced by VP-UML, or at least mention the need to edit ehcache.xml in the documentation.

Best regards,

-Glen

Hi gihrig,

Thanks for your post. I will discuss with our engineers and come back to you as soon as possible.

Best regards,
Jick

Hi gihrig,

The warnings are not problems. They just warn you that the class will use the default settings. Or you don’t want to get this warning?

Best regards,
Jick

Hi Jick…

I’m having the same problem… and I don’t want these warnings. Is this the only way to prevent these warnings being shown???

thanks

Hi Jick,

I’m having the same problem… and I don’t want these warnings. Is this the only way to prevent these warnings being shown?

Thank you.