Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • kbg
    replied
    Thanks, works - you helped me a lot!

    Leave a comment:


  • alius
    replied
    You can supply framework with your own Hibernate config by setting following properties in your server.properties file:
    Code:
    hibernate.config.lookupStyle=factory
    hibernate.config.className=your.hibernate.config.ProviderFactory
    Class your.hibernate.config.ProviderFactory should have method create() which should return prepared (not built yet) instance of org.hibernate.cfg.Configuration (buildSessionFactory() will be executed later).

    Alius.

    Leave a comment:


  • kbg
    replied
    Thanx for reply, but it does not work. The only possibility is to add NamingStrategy programmatically if DataSources don't have such functionality.

    I am afraid I will have to generate separate model for my web project or set my sessionFactory with proper config.

    Leave a comment:


  • alius
    replied
    Hi,

    Did you specify your naming strategy in hibernate configuration?
    Check this property:
    Code:
    hibernate.ejb.naming_strategy
    Alius.

    Leave a comment:


  • kbg
    replied
    Thanks for replay but in my case Hibernate needs to know about my NamingStrategy. Let me explain it more specific.

    I generate db from model with my NamingStrategy
    Code:
    conf.setNamingStrategy(new ExtNamingStrategy());
    Then db is created but names are changed, for example :
    OrgUnitODB class as table is org_units (same with class members).
    So, my ds.xml is:
    Code:
    <DataSource  
        ID="OrgUnitODB"
        serverType="hibernate"
        schemaBean="mypackage.OrgUnitODB"
        autoDeriveSchema="true"
    > 
    </DataSource>
    And there is problem because smartgwt points to table OrgUnitODB instead of org_units. Same with members. When I added annotation @table(name="org_units") to my model - it worked.
    But I don't want to set all tables and variables translated names because NamingStrategy should deal with it.

    My question is. Can I somewhere specify my NamingStrategy class or such functionality is not supported by SmartGwt?

    Leave a comment:


  • Isomorphic
    replied
    There doesn't appear to be any reason that SmartGWT would need to be aware of your NamingStrategy. With the HibernateDataSource, we call Hibernate APIs and do not deal with SQL table or column names directly.

    Leave a comment:


  • kbg
    started a topic DataSource Hibernate integration with Naming Strategy

    DataSource Hibernate integration with Naming Strategy

    Hello,
    I have problem with datasouce integration with Hibernate. I have big project with a lot of hibernate entities. So far we used EJB and DTO to retrive any objects from db. But we decied to use SmartGWT power and to integrate straight with hibernate at some views using autoDeriveSchema.
    BUT - our db is generated from model and there is set NamingStrategy. My question is : can I add NamingStrategy to hibernate config or ds.xml so that could SmartGWT handle it?
    Or do I have to re-generate model from db to my web project? O mby there is other way to do it quick and simple :)?
Working...
X