Announcement Announcement Module
No announcement yet.
application startup time Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • application startup time

    Hi all. I'm writing a JAVA/SWT application over Spring/hibernate/MySQL.
    Everithink works well, apart from the fact that each time
    I start the application, the hbm.xml mapping files parsing
    took very long. This is quite boring in order to perform automatic testing
    especiallly, but for application every-day use as well.
    In the hibernate site I found this:
    explainig how to "cache" the parsed objects into a file and
    then lazy inizializing them t startup.
    I have no idea about how to translate this into spring..
    someone can please help?

    I'm currently using this to create the context:
    ApplicationContext applicationContext =new FileSystemXmlApplicationContext(application_contex t_xml_file_path)

  • #2
    Well, like the post mentioned, it's experimental and added to the hibernate3 branch.

    Anyway, if you really really like to have this in your tests, I suggest you have a look at Spring's LocalSessionFactoryBean and specifically the afterPropertiesSet() method. It builds up the configuration using the Configuration class (same as mentioned in the post). You could implement this yourself using the afterPropertiesSet() code from Spring's local session factory bean and the code from the Hibernate post you mentioned.

    Can't you test some of your mappings in isolation (just load a couple of them instead of everything) or maintain the reference to the session factory for more than just one test (use constructor instead of setUp).