Urgent! How OFBiz supports multi databases;

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Urgent! How OFBiz supports multi databases;

Jack Liu-2
Hi All!
First, I add a delegator and a datasource in entity-engine.xml:

        <delegator name="hello3" entity-model-reader="main"
entity-group-reader="main" entity-eca-reader="main"
distributed-cache-clear-enabled="false">
    <group-map group-name="com.aicent"
datasource-name="hello3"/>
    </delegator>
   
    <datasource name="hello3"
        helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
        field-type-name="mysql"
        check-on-start="true"
        add-missing-on-start="true"
        check-pks-on-start="false"
        use-foreign-keys="true"
        join-style="ansi-no-parenthesis"
        alias-view-columns="false"
        drop-fk-use-foreign-key-keyword="true"
        table-type="InnoDB"
        character-set="latin1"
        collate="latin1_general_cs">
    <read-data reader-name="seed"/>
    <read-data reader-name="demo"/>
    <read-data reader-name="ext"/>
    <inline-jdbc
            jdbc-driver="com.mysql.jdbc.Driver"
            jdbc-uri="jdbc:mysql://127.0.0.1/hello"
            jdbc-username="root"
            jdbc-password="asdfgh"
            isolation-level="ReadCommitted"
            pool-minsize="2"
            pool-maxsize="20"/>
    <!-- <jndi-jdbc jndi-server-name="localjndi"
jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
</datasource>

Then,in my demo hello3's file entitygroup.xml:
        <entity-group group="com.aicent" entity="HelloPerson" />
     <entity-group group="com.aicent" entity="HelloHobby" />
     <entity-group group="com.aicent" entity="HelloPersonHobby" />

These entities HelloPerson HelloHobby HelloPersonHobby are defined in
entitymodel.xml

In services.xml I define a service named createHelloPerson:

<service name="createHelloPerson" engine="java"
                location="org.ofbiz.hello3.Hello3Services"
invoke="createHelloPerson">
                <description>Create a HelloPerson</description>
                <auto-attributes mode="IN" entity-name="HelloPerson"
include="nonpk" optional="true" />
                <attribute name="helloPersonId" mode="OUT" type="String"
optional="false" />
        </service>

All other files were well created.

Then I am starting OFBiz, A error encountered in console.log

        2009-02-05 18:02:59,540 (main) [UtilXml.java:243:DEBUG] XML Read
0.0s: D:/projects/ofbiz/hot-deploy/hello3/servicedef/services.xml
2009-02-05 18:02:59,555 (main) [   GenericDelegator.java:304:ERROR]
---- exception report
----------------------------------------------------------
Error getting entity definition from model
Exception: org.ofbiz.entity.GenericModelException
Message: Could not find definition for entity name hello3.HelloPerson
---- stack trace
---------------------------------------------------------------
org.ofbiz.entity.GenericModelException: Could not find definition for
entity name hello3.HelloPerson
org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader.java:456)
org.ofbiz.entity.GenericDelegator.getModelEntity(GenericDelegator.java:3
02)
org.ofbiz.service.ModelServiceReader.createAutoAttrDef(ModelServiceReade
r.java:480)
org.ofbiz.service.ModelServiceReader.createAutoAttrDefs(ModelServiceRead
er.java:452)
org.ofbiz.service.ModelServiceReader.createModelService(ModelServiceRead
er.java:311)
org.ofbiz.service.ModelServiceReader.getModelServices(ModelServiceReader
.java:166)
org.ofbiz.service.ModelServiceReader.<init>(ModelServiceReader.java:100)
org.ofbiz.service.ModelServiceReader.getModelServiceMap(ModelServiceRead
er.java:81)
org.ofbiz.service.DispatchContext.getGlobalServiceMap(DispatchContext.ja
va:320)
org.ofbiz.service.DispatchContext.loadReaders(DispatchContext.java:79)
org.ofbiz.service.GenericDispatcher.init(GenericDispatcher.java:127)
org.ofbiz.service.GenericDispatcher.<init>(GenericDispatcher.java:115)
org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
.java:75)
org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
.java:39)
org.ofbiz.entityext.EntityServiceFactory.getLocalDispatcher(EntityServic
eFactory.java:34)
org.ofbiz.entityext.EntityServiceFactory.getDispatchContext(EntityServic
eFactory.java:39)
org.ofbiz.entityext.eca.DelegatorEcaHandler.setDelegator(DelegatorEcaHan
dler.java:53)
org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:235)
org.ofbiz.entity.GenericDelegator.getGenericDelegator(GenericDelegator.j
ava:117)
org.ofbiz.catalina.container.CatalinaContainer.init(CatalinaContainer.ja
va:165)
org.ofbiz.base.container.ContainerLoader.loadContainer(ContainerLoader.j
ava:141)
org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:65)
org.ofbiz.base.start.Start.initStartLoaders(Start.java:248)
org.ofbiz.base.start.Start.init(Start.java:87)
org.ofbiz.base.start.Start.main(Start.java:403)


How to solve this problem or How OFBiz supports multi databases?

Thank you!


Best Regards,

Jack Liu

Reply | Threaded
Open this post in threaded view
|

Re: Urgent! How OFBiz supports multi databases;

BJ Freeman
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

this is the problem
Message: Could not find definition for entity name hello3.HelloPerson


Jack Liu sent the following on 2/5/2009 2:23 AM:

> Hi All!
> First, I add a delegator and a datasource in entity-engine.xml:
>
> <delegator name="hello3" entity-model-reader="main"
> entity-group-reader="main" entity-eca-reader="main"
> distributed-cache-clear-enabled="false">
>     <group-map group-name="com.aicent"
> datasource-name="hello3"/>
>     </delegator>
>    
>     <datasource name="hello3"
>         helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
>         field-type-name="mysql"
>         check-on-start="true"
>         add-missing-on-start="true"
>         check-pks-on-start="false"
>         use-foreign-keys="true"
>         join-style="ansi-no-parenthesis"
>         alias-view-columns="false"
>         drop-fk-use-foreign-key-keyword="true"
>         table-type="InnoDB"
>         character-set="latin1"
>         collate="latin1_general_cs">
>     <read-data reader-name="seed"/>
>     <read-data reader-name="demo"/>
>     <read-data reader-name="ext"/>
>     <inline-jdbc
>             jdbc-driver="com.mysql.jdbc.Driver"
>             jdbc-uri="jdbc:mysql://127.0.0.1/hello"
>             jdbc-username="root"
>             jdbc-password="asdfgh"
>             isolation-level="ReadCommitted"
>             pool-minsize="2"
>             pool-maxsize="20"/>
>     <!-- <jndi-jdbc jndi-server-name="localjndi"
> jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
> </datasource>
>
> Then,in my demo hello3's file entitygroup.xml:
> <entity-group group="com.aicent" entity="HelloPerson" />
>      <entity-group group="com.aicent" entity="HelloHobby" />
>      <entity-group group="com.aicent" entity="HelloPersonHobby" />
>
> These entities HelloPerson HelloHobby HelloPersonHobby are defined in
> entitymodel.xml
>
> In services.xml I define a service named createHelloPerson:
>
> <service name="createHelloPerson" engine="java"
> location="org.ofbiz.hello3.Hello3Services"
> invoke="createHelloPerson">
> <description>Create a HelloPerson</description>
> <auto-attributes mode="IN" entity-name="HelloPerson"
> include="nonpk" optional="true" />
> <attribute name="helloPersonId" mode="OUT" type="String"
> optional="false" />
> </service>
>
> All other files were well created.
>
> Then I am starting OFBiz, A error encountered in console.log
>
> 2009-02-05 18:02:59,540 (main) [UtilXml.java:243:DEBUG] XML Read
> 0.0s: D:/projects/ofbiz/hot-deploy/hello3/servicedef/services.xml
> 2009-02-05 18:02:59,555 (main) [   GenericDelegator.java:304:ERROR]
> ---- exception report
> ----------------------------------------------------------
> Error getting entity definition from model
> Exception: org.ofbiz.entity.GenericModelException
> Message: Could not find definition for entity name hello3.HelloPerson
> ---- stack trace
> ---------------------------------------------------------------
> org.ofbiz.entity.GenericModelException: Could not find definition for
> entity name hello3.HelloPerson
> org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader.java:456)
> org.ofbiz.entity.GenericDelegator.getModelEntity(GenericDelegator.java:3
> 02)
> org.ofbiz.service.ModelServiceReader.createAutoAttrDef(ModelServiceReade
> r.java:480)
> org.ofbiz.service.ModelServiceReader.createAutoAttrDefs(ModelServiceRead
> er.java:452)
> org.ofbiz.service.ModelServiceReader.createModelService(ModelServiceRead
> er.java:311)
> org.ofbiz.service.ModelServiceReader.getModelServices(ModelServiceReader
> .java:166)
> org.ofbiz.service.ModelServiceReader.<init>(ModelServiceReader.java:100)
> org.ofbiz.service.ModelServiceReader.getModelServiceMap(ModelServiceRead
> er.java:81)
> org.ofbiz.service.DispatchContext.getGlobalServiceMap(DispatchContext.ja
> va:320)
> org.ofbiz.service.DispatchContext.loadReaders(DispatchContext.java:79)
> org.ofbiz.service.GenericDispatcher.init(GenericDispatcher.java:127)
> org.ofbiz.service.GenericDispatcher.<init>(GenericDispatcher.java:115)
> org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
> .java:75)
> org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
> .java:39)
> org.ofbiz.entityext.EntityServiceFactory.getLocalDispatcher(EntityServic
> eFactory.java:34)
> org.ofbiz.entityext.EntityServiceFactory.getDispatchContext(EntityServic
> eFactory.java:39)
> org.ofbiz.entityext.eca.DelegatorEcaHandler.setDelegator(DelegatorEcaHan
> dler.java:53)
> org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:235)
> org.ofbiz.entity.GenericDelegator.getGenericDelegator(GenericDelegator.j
> ava:117)
> org.ofbiz.catalina.container.CatalinaContainer.init(CatalinaContainer.ja
> va:165)
> org.ofbiz.base.container.ContainerLoader.loadContainer(ContainerLoader.j
> ava:141)
> org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:65)
> org.ofbiz.base.start.Start.initStartLoaders(Start.java:248)
> org.ofbiz.base.start.Start.init(Start.java:87)
> org.ofbiz.base.start.Start.main(Start.java:403)
>
>
> How to solve this problem or How OFBiz supports multi databases?
>
> Thank you!
>
>
> Best Regards,
>
> Jack Liu
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJisWdrP3NbaWWqE4RAo/zAKC0SmNlHrVjIzdJ5LRnTX9/WdY6fACfS3g3
Qbg+wfebFKT4aj+pJ/bTZ38=
=BmRS
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: Urgent! How OFBiz supports multi databases;

BJ Freeman
In reply to this post by Jack Liu-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

http://docs.ofbiz.org/display/OFBIZ/OFBiz+Beginner%27s+Development+Guide+Using+Practice+Application

Jack Liu sent the following on 2/5/2009 2:23 AM:

> Hi All!
> First, I add a delegator and a datasource in entity-engine.xml:
>
> <delegator name="hello3" entity-model-reader="main"
> entity-group-reader="main" entity-eca-reader="main"
> distributed-cache-clear-enabled="false">
>     <group-map group-name="com.aicent"
> datasource-name="hello3"/>
>     </delegator>
>    
>     <datasource name="hello3"
>         helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
>         field-type-name="mysql"
>         check-on-start="true"
>         add-missing-on-start="true"
>         check-pks-on-start="false"
>         use-foreign-keys="true"
>         join-style="ansi-no-parenthesis"
>         alias-view-columns="false"
>         drop-fk-use-foreign-key-keyword="true"
>         table-type="InnoDB"
>         character-set="latin1"
>         collate="latin1_general_cs">
>     <read-data reader-name="seed"/>
>     <read-data reader-name="demo"/>
>     <read-data reader-name="ext"/>
>     <inline-jdbc
>             jdbc-driver="com.mysql.jdbc.Driver"
>             jdbc-uri="jdbc:mysql://127.0.0.1/hello"
>             jdbc-username="root"
>             jdbc-password="asdfgh"
>             isolation-level="ReadCommitted"
>             pool-minsize="2"
>             pool-maxsize="20"/>
>     <!-- <jndi-jdbc jndi-server-name="localjndi"
> jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
> </datasource>
>
> Then,in my demo hello3's file entitygroup.xml:
> <entity-group group="com.aicent" entity="HelloPerson" />
>      <entity-group group="com.aicent" entity="HelloHobby" />
>      <entity-group group="com.aicent" entity="HelloPersonHobby" />
>
> These entities HelloPerson HelloHobby HelloPersonHobby are defined in
> entitymodel.xml
>
> In services.xml I define a service named createHelloPerson:
>
> <service name="createHelloPerson" engine="java"
> location="org.ofbiz.hello3.Hello3Services"
> invoke="createHelloPerson">
> <description>Create a HelloPerson</description>
> <auto-attributes mode="IN" entity-name="HelloPerson"
> include="nonpk" optional="true" />
> <attribute name="helloPersonId" mode="OUT" type="String"
> optional="false" />
> </service>
>
> All other files were well created.
>
> Then I am starting OFBiz, A error encountered in console.log
>
> 2009-02-05 18:02:59,540 (main) [UtilXml.java:243:DEBUG] XML Read
> 0.0s: D:/projects/ofbiz/hot-deploy/hello3/servicedef/services.xml
> 2009-02-05 18:02:59,555 (main) [   GenericDelegator.java:304:ERROR]
> ---- exception report
> ----------------------------------------------------------
> Error getting entity definition from model
> Exception: org.ofbiz.entity.GenericModelException
> Message: Could not find definition for entity name hello3.HelloPerson
> ---- stack trace
> ---------------------------------------------------------------
> org.ofbiz.entity.GenericModelException: Could not find definition for
> entity name hello3.HelloPerson
> org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader.java:456)
> org.ofbiz.entity.GenericDelegator.getModelEntity(GenericDelegator.java:3
> 02)
> org.ofbiz.service.ModelServiceReader.createAutoAttrDef(ModelServiceReade
> r.java:480)
> org.ofbiz.service.ModelServiceReader.createAutoAttrDefs(ModelServiceRead
> er.java:452)
> org.ofbiz.service.ModelServiceReader.createModelService(ModelServiceRead
> er.java:311)
> org.ofbiz.service.ModelServiceReader.getModelServices(ModelServiceReader
> .java:166)
> org.ofbiz.service.ModelServiceReader.<init>(ModelServiceReader.java:100)
> org.ofbiz.service.ModelServiceReader.getModelServiceMap(ModelServiceRead
> er.java:81)
> org.ofbiz.service.DispatchContext.getGlobalServiceMap(DispatchContext.ja
> va:320)
> org.ofbiz.service.DispatchContext.loadReaders(DispatchContext.java:79)
> org.ofbiz.service.GenericDispatcher.init(GenericDispatcher.java:127)
> org.ofbiz.service.GenericDispatcher.<init>(GenericDispatcher.java:115)
> org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
> .java:75)
> org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
> .java:39)
> org.ofbiz.entityext.EntityServiceFactory.getLocalDispatcher(EntityServic
> eFactory.java:34)
> org.ofbiz.entityext.EntityServiceFactory.getDispatchContext(EntityServic
> eFactory.java:39)
> org.ofbiz.entityext.eca.DelegatorEcaHandler.setDelegator(DelegatorEcaHan
> dler.java:53)
> org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:235)
> org.ofbiz.entity.GenericDelegator.getGenericDelegator(GenericDelegator.j
> ava:117)
> org.ofbiz.catalina.container.CatalinaContainer.init(CatalinaContainer.ja
> va:165)
> org.ofbiz.base.container.ContainerLoader.loadContainer(ContainerLoader.j
> ava:141)
> org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:65)
> org.ofbiz.base.start.Start.initStartLoaders(Start.java:248)
> org.ofbiz.base.start.Start.init(Start.java:87)
> org.ofbiz.base.start.Start.main(Start.java:403)
>
>
> How to solve this problem or How OFBiz supports multi databases?
>
> Thank you!
>
>
> Best Regards,
>
> Jack Liu
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJisYzrP3NbaWWqE4RAnl9AJ9kF7L2nU2DbFhj69+ASqS8TouvMACgzTTh
8DwDojxFti4RfBQcGujwyfU=
=EcG1
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: Urgent! How OFBiz supports multi databases;

Vivek Mishra-2
In reply to this post by Jack Liu-2
Hello Jack,

Just go through this link
http://fisheye6.atlassian.com/changelog/ofbiz/?cs=672821&@csTruncateDiffs=false
and let me know if you are having any more problem.

Regards,
--
Vivek


Jack Liu wrote:

> Hi All!
> First, I add a delegator and a datasource in entity-engine.xml:
>
> <delegator name="hello3" entity-model-reader="main"
> entity-group-reader="main" entity-eca-reader="main"
> distributed-cache-clear-enabled="false">
>     <group-map group-name="com.aicent"
> datasource-name="hello3"/>
>     </delegator>
>    
>     <datasource name="hello3"
>         helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
>         field-type-name="mysql"
>         check-on-start="true"
>         add-missing-on-start="true"
>         check-pks-on-start="false"
>         use-foreign-keys="true"
>         join-style="ansi-no-parenthesis"
>         alias-view-columns="false"
>         drop-fk-use-foreign-key-keyword="true"
>         table-type="InnoDB"
>         character-set="latin1"
>         collate="latin1_general_cs">
>     <read-data reader-name="seed"/>
>     <read-data reader-name="demo"/>
>     <read-data reader-name="ext"/>
>     <inline-jdbc
>             jdbc-driver="com.mysql.jdbc.Driver"
>             jdbc-uri="jdbc:mysql://127.0.0.1/hello"
>             jdbc-username="root"
>             jdbc-password="asdfgh"
>             isolation-level="ReadCommitted"
>             pool-minsize="2"
>             pool-maxsize="20"/>
>     <!-- <jndi-jdbc jndi-server-name="localjndi"
> jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
> </datasource>
>
> Then,in my demo hello3's file entitygroup.xml:
> <entity-group group="com.aicent" entity="HelloPerson" />
>      <entity-group group="com.aicent" entity="HelloHobby" />
>      <entity-group group="com.aicent" entity="HelloPersonHobby" />
>
> These entities HelloPerson HelloHobby HelloPersonHobby are defined in
> entitymodel.xml
>
> In services.xml I define a service named createHelloPerson:
>
> <service name="createHelloPerson" engine="java"
> location="org.ofbiz.hello3.Hello3Services"
> invoke="createHelloPerson">
> <description>Create a HelloPerson</description>
> <auto-attributes mode="IN" entity-name="HelloPerson"
> include="nonpk" optional="true" />
> <attribute name="helloPersonId" mode="OUT" type="String"
> optional="false" />
> </service>
>
> All other files were well created.
>
> Then I am starting OFBiz, A error encountered in console.log
>
> 2009-02-05 18:02:59,540 (main) [UtilXml.java:243:DEBUG] XML Read
> 0.0s: D:/projects/ofbiz/hot-deploy/hello3/servicedef/services.xml
> 2009-02-05 18:02:59,555 (main) [   GenericDelegator.java:304:ERROR]
> ---- exception report
> ----------------------------------------------------------
> Error getting entity definition from model
> Exception: org.ofbiz.entity.GenericModelException
> Message: Could not find definition for entity name hello3.HelloPerson
> ---- stack trace
> ---------------------------------------------------------------
> org.ofbiz.entity.GenericModelException: Could not find definition for
> entity name hello3.HelloPerson
> org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader.java:456)
> org.ofbiz.entity.GenericDelegator.getModelEntity(GenericDelegator.java:3
> 02)
> org.ofbiz.service.ModelServiceReader.createAutoAttrDef(ModelServiceReade
> r.java:480)
> org.ofbiz.service.ModelServiceReader.createAutoAttrDefs(ModelServiceRead
> er.java:452)
> org.ofbiz.service.ModelServiceReader.createModelService(ModelServiceRead
> er.java:311)
> org.ofbiz.service.ModelServiceReader.getModelServices(ModelServiceReader
> .java:166)
> org.ofbiz.service.ModelServiceReader.<init>(ModelServiceReader.java:100)
> org.ofbiz.service.ModelServiceReader.getModelServiceMap(ModelServiceRead
> er.java:81)
> org.ofbiz.service.DispatchContext.getGlobalServiceMap(DispatchContext.ja
> va:320)
> org.ofbiz.service.DispatchContext.loadReaders(DispatchContext.java:79)
> org.ofbiz.service.GenericDispatcher.init(GenericDispatcher.java:127)
> org.ofbiz.service.GenericDispatcher.<init>(GenericDispatcher.java:115)
> org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
> .java:75)
> org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
> .java:39)
> org.ofbiz.entityext.EntityServiceFactory.getLocalDispatcher(EntityServic
> eFactory.java:34)
> org.ofbiz.entityext.EntityServiceFactory.getDispatchContext(EntityServic
> eFactory.java:39)
> org.ofbiz.entityext.eca.DelegatorEcaHandler.setDelegator(DelegatorEcaHan
> dler.java:53)
> org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:235)
> org.ofbiz.entity.GenericDelegator.getGenericDelegator(GenericDelegator.j
> ava:117)
> org.ofbiz.catalina.container.CatalinaContainer.init(CatalinaContainer.ja
> va:165)
> org.ofbiz.base.container.ContainerLoader.loadContainer(ContainerLoader.j
> ava:141)
> org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:65)
> org.ofbiz.base.start.Start.initStartLoaders(Start.java:248)
> org.ofbiz.base.start.Start.init(Start.java:87)
> org.ofbiz.base.start.Start.main(Start.java:403)
>
>
> How to solve this problem or How OFBiz supports multi databases?
>
> Thank you!
>
>
> Best Regards,
>
> Jack Liu
>
>
>  


smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Urgent! How OFBiz supports multi databases;

Vivek Mishra-2
In reply to this post by BJ Freeman
For more detail see this commit
http://svn.apache.org/viewvc?rev=676933&view=rev

Thanks and Regards,
--
Vivek Mishra 


BJ Freeman wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

http://docs.ofbiz.org/display/OFBIZ/OFBiz+Beginner%27s+Development+Guide+Using+Practice+Application

Jack Liu sent the following on 2/5/2009 2:23 AM:
  
Hi All!
First, I add a delegator and a datasource in entity-engine.xml:

	<delegator name="hello3" entity-model-reader="main"
entity-group-reader="main" entity-eca-reader="main"
distributed-cache-clear-enabled="false">
    		<group-map group-name="com.aicent"
datasource-name="hello3"/>
    </delegator>
    
    <datasource name="hello3"
        helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
        field-type-name="mysql"
        check-on-start="true"
        add-missing-on-start="true"
        check-pks-on-start="false"
        use-foreign-keys="true"
        join-style="ansi-no-parenthesis"
        alias-view-columns="false"
        drop-fk-use-foreign-key-keyword="true"
        table-type="InnoDB"
        character-set="latin1"
        collate="latin1_general_cs">
    <read-data reader-name="seed"/>
    <read-data reader-name="demo"/>
    <read-data reader-name="ext"/>
    <inline-jdbc
            jdbc-driver="com.mysql.jdbc.Driver"
            jdbc-uri="jdbc:mysql://127.0.0.1/hello"
            jdbc-username="root"
            jdbc-password="asdfgh"
            isolation-level="ReadCommitted"
            pool-minsize="2"
            pool-maxsize="20"/>
    <!-- <jndi-jdbc jndi-server-name="localjndi"
jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
</datasource>

Then,in my demo hello3's file entitygroup.xml:
	<entity-group group="com.aicent" entity="HelloPerson" />
     <entity-group group="com.aicent" entity="HelloHobby" />
     <entity-group group="com.aicent" entity="HelloPersonHobby" />

These entities HelloPerson HelloHobby HelloPersonHobby are defined in
entitymodel.xml

In services.xml I define a service named createHelloPerson:

<service name="createHelloPerson" engine="java"
		location="org.ofbiz.hello3.Hello3Services"
invoke="createHelloPerson">
		<description>Create a HelloPerson</description>
		<auto-attributes mode="IN" entity-name="HelloPerson"
include="nonpk" optional="true" />
		<attribute name="helloPersonId" mode="OUT" type="String"
optional="false" />
	</service>

All other files were well created.

Then I am starting OFBiz, A error encountered in console.log

	2009-02-05 18:02:59,540 (main) [UtilXml.java:243:DEBUG] XML Read
0.0s: D:/projects/ofbiz/hot-deploy/hello3/servicedef/services.xml
2009-02-05 18:02:59,555 (main) [   GenericDelegator.java:304:ERROR] 
---- exception report
----------------------------------------------------------
Error getting entity definition from model
Exception: org.ofbiz.entity.GenericModelException
Message: Could not find definition for entity name hello3.HelloPerson
---- stack trace
---------------------------------------------------------------
org.ofbiz.entity.GenericModelException: Could not find definition for
entity name hello3.HelloPerson
org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader.java:456)
org.ofbiz.entity.GenericDelegator.getModelEntity(GenericDelegator.java:3
02)
org.ofbiz.service.ModelServiceReader.createAutoAttrDef(ModelServiceReade
r.java:480)
org.ofbiz.service.ModelServiceReader.createAutoAttrDefs(ModelServiceRead
er.java:452)
org.ofbiz.service.ModelServiceReader.createModelService(ModelServiceRead
er.java:311)
org.ofbiz.service.ModelServiceReader.getModelServices(ModelServiceReader
.java:166)
org.ofbiz.service.ModelServiceReader.<init>(ModelServiceReader.java:100)
org.ofbiz.service.ModelServiceReader.getModelServiceMap(ModelServiceRead
er.java:81)
org.ofbiz.service.DispatchContext.getGlobalServiceMap(DispatchContext.ja
va:320)
org.ofbiz.service.DispatchContext.loadReaders(DispatchContext.java:79)
org.ofbiz.service.GenericDispatcher.init(GenericDispatcher.java:127)
org.ofbiz.service.GenericDispatcher.<init>(GenericDispatcher.java:115)
org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
.java:75)
org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
.java:39)
org.ofbiz.entityext.EntityServiceFactory.getLocalDispatcher(EntityServic
eFactory.java:34)
org.ofbiz.entityext.EntityServiceFactory.getDispatchContext(EntityServic
eFactory.java:39)
org.ofbiz.entityext.eca.DelegatorEcaHandler.setDelegator(DelegatorEcaHan
dler.java:53)
org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:235)
org.ofbiz.entity.GenericDelegator.getGenericDelegator(GenericDelegator.j
ava:117)
org.ofbiz.catalina.container.CatalinaContainer.init(CatalinaContainer.ja
va:165)
org.ofbiz.base.container.ContainerLoader.loadContainer(ContainerLoader.j
ava:141)
org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:65)
org.ofbiz.base.start.Start.initStartLoaders(Start.java:248)
org.ofbiz.base.start.Start.init(Start.java:87)
org.ofbiz.base.start.Start.main(Start.java:403)


How to solve this problem or How OFBiz supports multi databases?

Thank you!


Best Regards,

Jack Liu 


    
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJisYzrP3NbaWWqE4RAnl9AJ9kF7L2nU2DbFhj69+ASqS8TouvMACgzTTh
8DwDojxFti4RfBQcGujwyfU=
=EcG1
-----END PGP SIGNATURE-----
  



smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Urgent! How OFBiz supports multi databases;

Jack Liu-2
In reply to this post by BJ Freeman
Thank you for your response!
But,maybe you didn't catch what I meant
I knew it could not find definition for entity name hello3.HelloPerson.
Actually it could not find definition for entity name HelloPerson either.
So I'am anxious to know how OFBiz supports multi databases.

-----Original Message-----
From: BJ Freeman [mailto:[hidden email]]
Sent: 2009年2月5日 18:55
To: [hidden email]
Subject: Re: Urgent! How OFBiz supports multi databases;

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

this is the problem
Message: Could not find definition for entity name hello3.HelloPerson


Jack Liu sent the following on 2/5/2009 2:23 AM:

> Hi All!
> First, I add a delegator and a datasource in entity-engine.xml:
>
> <delegator name="hello3" entity-model-reader="main"
> entity-group-reader="main" entity-eca-reader="main"
> distributed-cache-clear-enabled="false">
>     <group-map group-name="com.aicent"
> datasource-name="hello3"/>
>     </delegator>
>    
>     <datasource name="hello3"
>         helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
>         field-type-name="mysql"
>         check-on-start="true"
>         add-missing-on-start="true"
>         check-pks-on-start="false"
>         use-foreign-keys="true"
>         join-style="ansi-no-parenthesis"
>         alias-view-columns="false"
>         drop-fk-use-foreign-key-keyword="true"
>         table-type="InnoDB"
>         character-set="latin1"
>         collate="latin1_general_cs">
>     <read-data reader-name="seed"/>
>     <read-data reader-name="demo"/>
>     <read-data reader-name="ext"/>
>     <inline-jdbc
>             jdbc-driver="com.mysql.jdbc.Driver"
>             jdbc-uri="jdbc:mysql://127.0.0.1/hello"
>             jdbc-username="root"
>             jdbc-password="asdfgh"
>             isolation-level="ReadCommitted"
>             pool-minsize="2"
>             pool-maxsize="20"/>
>     <!-- <jndi-jdbc jndi-server-name="localjndi"
> jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
> </datasource>
>
> Then,in my demo hello3's file entitygroup.xml:
> <entity-group group="com.aicent" entity="HelloPerson" />
>      <entity-group group="com.aicent" entity="HelloHobby" />
>      <entity-group group="com.aicent" entity="HelloPersonHobby" />
>
> These entities HelloPerson HelloHobby HelloPersonHobby are defined in
> entitymodel.xml
>
> In services.xml I define a service named createHelloPerson:
>
> <service name="createHelloPerson" engine="java"
> location="org.ofbiz.hello3.Hello3Services"
> invoke="createHelloPerson">
> <description>Create a HelloPerson</description>
> <auto-attributes mode="IN" entity-name="HelloPerson"
> include="nonpk" optional="true" />
> <attribute name="helloPersonId" mode="OUT" type="String"
> optional="false" />
> </service>
>
> All other files were well created.
>
> Then I am starting OFBiz, A error encountered in console.log
>
> 2009-02-05 18:02:59,540 (main) [UtilXml.java:243:DEBUG] XML Read
> 0.0s: D:/projects/ofbiz/hot-deploy/hello3/servicedef/services.xml
> 2009-02-05 18:02:59,555 (main) [   GenericDelegator.java:304:ERROR]
> ---- exception report
> ----------------------------------------------------------
> Error getting entity definition from model
> Exception: org.ofbiz.entity.GenericModelException
> Message: Could not find definition for entity name hello3.HelloPerson
> ---- stack trace
> ---------------------------------------------------------------
> org.ofbiz.entity.GenericModelException: Could not find definition for
> entity name hello3.HelloPerson
> org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader.java:456)
> org.ofbiz.entity.GenericDelegator.getModelEntity(GenericDelegator.java:3
> 02)
> org.ofbiz.service.ModelServiceReader.createAutoAttrDef(ModelServiceReade
> r.java:480)
> org.ofbiz.service.ModelServiceReader.createAutoAttrDefs(ModelServiceRead
> er.java:452)
> org.ofbiz.service.ModelServiceReader.createModelService(ModelServiceRead
> er.java:311)
> org.ofbiz.service.ModelServiceReader.getModelServices(ModelServiceReader
> .java:166)
> org.ofbiz.service.ModelServiceReader.<init>(ModelServiceReader.java:100)
> org.ofbiz.service.ModelServiceReader.getModelServiceMap(ModelServiceRead
> er.java:81)
> org.ofbiz.service.DispatchContext.getGlobalServiceMap(DispatchContext.ja
> va:320)
> org.ofbiz.service.DispatchContext.loadReaders(DispatchContext.java:79)
> org.ofbiz.service.GenericDispatcher.init(GenericDispatcher.java:127)
> org.ofbiz.service.GenericDispatcher.<init>(GenericDispatcher.java:115)
> org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
> .java:75)
> org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
> .java:39)
> org.ofbiz.entityext.EntityServiceFactory.getLocalDispatcher(EntityServic
> eFactory.java:34)
> org.ofbiz.entityext.EntityServiceFactory.getDispatchContext(EntityServic
> eFactory.java:39)
> org.ofbiz.entityext.eca.DelegatorEcaHandler.setDelegator(DelegatorEcaHan
> dler.java:53)
> org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:235)
> org.ofbiz.entity.GenericDelegator.getGenericDelegator(GenericDelegator.j
> ava:117)
> org.ofbiz.catalina.container.CatalinaContainer.init(CatalinaContainer.ja
> va:165)
> org.ofbiz.base.container.ContainerLoader.loadContainer(ContainerLoader.j
> ava:141)
> org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:65)
> org.ofbiz.base.start.Start.initStartLoaders(Start.java:248)
> org.ofbiz.base.start.Start.init(Start.java:87)
> org.ofbiz.base.start.Start.main(Start.java:403)
>
>
> How to solve this problem or How OFBiz supports multi databases?
>
> Thank you!
>
>
> Best Regards,
>
> Jack Liu
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJisWdrP3NbaWWqE4RAo/zAKC0SmNlHrVjIzdJ5LRnTX9/WdY6fACfS3g3
Qbg+wfebFKT4aj+pJ/bTZ38=
=BmRS
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

RE: Urgent! How OFBiz supports multi databases;

Jack Liu-2
In reply to this post by Vivek Mishra-2
Thank you!
You mean I modify all the seven files in my ofbiz according to the link you give?
And How I set the attribute default-group-name in delegator hello3 and default?
Is it right below?

<delegator name="default" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" distributed-cache-clear-enabled="false" >
        <group-map group-name="org.ofbiz" datasource-name="localmysql"/>
    </delegator>

<delegator name="hello3" entity-model-reader="main"   entity-group-reader="main" entity-eca-reader="main" distributed-cache-clear-enabled="false" default-group-name="com.aicent">
    <group-map group-name="com.aicent" datasource-name="hello3"/>
    </delegator>



-----Original Message-----
From: Vivek Mishra [mailto:[hidden email]]
Sent: 2009年2月5日 20:39
To: [hidden email]
Subject: Re: Urgent! How OFBiz supports multi databases;

Hello Jack,

Just go through this link
http://fisheye6.atlassian.com/changelog/ofbiz/?cs=672821&@csTruncateDiffs=false
and let me know if you are having any more problem.

Regards,
--
Vivek


Jack Liu wrote:

> Hi All!
> First, I add a delegator and a datasource in entity-engine.xml:
>
> <delegator name="hello3" entity-model-reader="main"
> entity-group-reader="main" entity-eca-reader="main"
> distributed-cache-clear-enabled="false">
>     <group-map group-name="com.aicent"
> datasource-name="hello3"/>
>     </delegator>
>    
>     <datasource name="hello3"
>         helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
>         field-type-name="mysql"
>         check-on-start="true"
>         add-missing-on-start="true"
>         check-pks-on-start="false"
>         use-foreign-keys="true"
>         join-style="ansi-no-parenthesis"
>         alias-view-columns="false"
>         drop-fk-use-foreign-key-keyword="true"
>         table-type="InnoDB"
>         character-set="latin1"
>         collate="latin1_general_cs">
>     <read-data reader-name="seed"/>
>     <read-data reader-name="demo"/>
>     <read-data reader-name="ext"/>
>     <inline-jdbc
>             jdbc-driver="com.mysql.jdbc.Driver"
>             jdbc-uri="jdbc:mysql://127.0.0.1/hello"
>             jdbc-username="root"
>             jdbc-password="asdfgh"
>             isolation-level="ReadCommitted"
>             pool-minsize="2"
>             pool-maxsize="20"/>
>     <!-- <jndi-jdbc jndi-server-name="localjndi"
> jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
> </datasource>
>
> Then,in my demo hello3's file entitygroup.xml:
> <entity-group group="com.aicent" entity="HelloPerson" />
>      <entity-group group="com.aicent" entity="HelloHobby" />
>      <entity-group group="com.aicent" entity="HelloPersonHobby" />
>
> These entities HelloPerson HelloHobby HelloPersonHobby are defined in
> entitymodel.xml
>
> In services.xml I define a service named createHelloPerson:
>
> <service name="createHelloPerson" engine="java"
> location="org.ofbiz.hello3.Hello3Services"
> invoke="createHelloPerson">
> <description>Create a HelloPerson</description>
> <auto-attributes mode="IN" entity-name="HelloPerson"
> include="nonpk" optional="true" />
> <attribute name="helloPersonId" mode="OUT" type="String"
> optional="false" />
> </service>
>
> All other files were well created.
>
> Then I am starting OFBiz, A error encountered in console.log
>
> 2009-02-05 18:02:59,540 (main) [UtilXml.java:243:DEBUG] XML Read
> 0.0s: D:/projects/ofbiz/hot-deploy/hello3/servicedef/services.xml
> 2009-02-05 18:02:59,555 (main) [   GenericDelegator.java:304:ERROR]
> ---- exception report
> ----------------------------------------------------------
> Error getting entity definition from model
> Exception: org.ofbiz.entity.GenericModelException
> Message: Could not find definition for entity name hello3.HelloPerson
> ---- stack trace
> ---------------------------------------------------------------
> org.ofbiz.entity.GenericModelException: Could not find definition for
> entity name hello3.HelloPerson
> org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader.java:456)
> org.ofbiz.entity.GenericDelegator.getModelEntity(GenericDelegator.java:3
> 02)
> org.ofbiz.service.ModelServiceReader.createAutoAttrDef(ModelServiceReade
> r.java:480)
> org.ofbiz.service.ModelServiceReader.createAutoAttrDefs(ModelServiceRead
> er.java:452)
> org.ofbiz.service.ModelServiceReader.createModelService(ModelServiceRead
> er.java:311)
> org.ofbiz.service.ModelServiceReader.getModelServices(ModelServiceReader
> .java:166)
> org.ofbiz.service.ModelServiceReader.<init>(ModelServiceReader.java:100)
> org.ofbiz.service.ModelServiceReader.getModelServiceMap(ModelServiceRead
> er.java:81)
> org.ofbiz.service.DispatchContext.getGlobalServiceMap(DispatchContext.ja
> va:320)
> org.ofbiz.service.DispatchContext.loadReaders(DispatchContext.java:79)
> org.ofbiz.service.GenericDispatcher.init(GenericDispatcher.java:127)
> org.ofbiz.service.GenericDispatcher.<init>(GenericDispatcher.java:115)
> org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
> .java:75)
> org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
> .java:39)
> org.ofbiz.entityext.EntityServiceFactory.getLocalDispatcher(EntityServic
> eFactory.java:34)
> org.ofbiz.entityext.EntityServiceFactory.getDispatchContext(EntityServic
> eFactory.java:39)
> org.ofbiz.entityext.eca.DelegatorEcaHandler.setDelegator(DelegatorEcaHan
> dler.java:53)
> org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:235)
> org.ofbiz.entity.GenericDelegator.getGenericDelegator(GenericDelegator.j
> ava:117)
> org.ofbiz.catalina.container.CatalinaContainer.init(CatalinaContainer.ja
> va:165)
> org.ofbiz.base.container.ContainerLoader.loadContainer(ContainerLoader.j
> ava:141)
> org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:65)
> org.ofbiz.base.start.Start.initStartLoaders(Start.java:248)
> org.ofbiz.base.start.Start.init(Start.java:87)
> org.ofbiz.base.start.Start.main(Start.java:403)
>
>
> How to solve this problem or How OFBiz supports multi databases?
>
> Thank you!
>
>
> Best Regards,
>
> Jack Liu
>
>
>  

Reply | Threaded
Open this post in threaded view
|

Re: Urgent! How OFBiz supports multi databases;

BJ Freeman
In reply to this post by Jack Liu-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

the simple answer is yes.
However I don't think what you have in mind is covered under that answer.
your problem of finding an entity has nothing to do with a database.
Think of the database only as a storage medium.
the error your getting is from the entity engine.
it would be wise to re-visit the tutorial and the links on the videos.

http://docs.ofbiz.org/display/OFBIZ/OFBiz+Beginner%27s+Development+Guide+Using+Practice+Application
This will save you having to ask basic questions on the Mailing list and
 speed up you developement.

Jack Liu sent the following on 2/5/2009 7:16 AM:

> Thank you for your response!
> But,maybe you didn't catch what I meant
> I knew it could not find definition for entity name hello3.HelloPerson.
> Actually it could not find definition for entity name HelloPerson either.
> So I'am anxious to know how OFBiz supports multi databases.
>
> -----Original Message-----
> From: BJ Freeman [mailto:[hidden email]]
> Sent: 2009年2月5日 18:55
> To: [hidden email]
> Subject: Re: Urgent! How OFBiz supports multi databases;
>
> this is the problem
> Message: Could not find definition for entity name hello3.HelloPerson
>
>
> Jack Liu sent the following on 2/5/2009 2:23 AM:
>> Hi All!
>> First, I add a delegator and a datasource in entity-engine.xml:
>
>> <delegator name="hello3" entity-model-reader="main"
>> entity-group-reader="main" entity-eca-reader="main"
>> distributed-cache-clear-enabled="false">
>>     <group-map group-name="com.aicent"
>> datasource-name="hello3"/>
>>     </delegator>
>
>>     <datasource name="hello3"
>>         helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
>>         field-type-name="mysql"
>>         check-on-start="true"
>>         add-missing-on-start="true"
>>         check-pks-on-start="false"
>>         use-foreign-keys="true"
>>         join-style="ansi-no-parenthesis"
>>         alias-view-columns="false"
>>         drop-fk-use-foreign-key-keyword="true"
>>         table-type="InnoDB"
>>         character-set="latin1"
>>         collate="latin1_general_cs">
>>     <read-data reader-name="seed"/>
>>     <read-data reader-name="demo"/>
>>     <read-data reader-name="ext"/>
>>     <inline-jdbc
>>             jdbc-driver="com.mysql.jdbc.Driver"
>>             jdbc-uri="jdbc:mysql://127.0.0.1/hello"
>>             jdbc-username="root"
>>             jdbc-password="asdfgh"
>>             isolation-level="ReadCommitted"
>>             pool-minsize="2"
>>             pool-maxsize="20"/>
>>     <!-- <jndi-jdbc jndi-server-name="localjndi"
>> jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
>> </datasource>
>
>> Then,in my demo hello3's file entitygroup.xml:
>> <entity-group group="com.aicent" entity="HelloPerson" />
>>      <entity-group group="com.aicent" entity="HelloHobby" />
>>      <entity-group group="com.aicent" entity="HelloPersonHobby" />
>
>> These entities HelloPerson HelloHobby HelloPersonHobby are defined in
>> entitymodel.xml
>
>> In services.xml I define a service named createHelloPerson:
>
>> <service name="createHelloPerson" engine="java"
>> location="org.ofbiz.hello3.Hello3Services"
>> invoke="createHelloPerson">
>> <description>Create a HelloPerson</description>
>> <auto-attributes mode="IN" entity-name="HelloPerson"
>> include="nonpk" optional="true" />
>> <attribute name="helloPersonId" mode="OUT" type="String"
>> optional="false" />
>> </service>
>
>> All other files were well created.
>
>> Then I am starting OFBiz, A error encountered in console.log
>
>> 2009-02-05 18:02:59,540 (main) [UtilXml.java:243:DEBUG] XML Read
>> 0.0s: D:/projects/ofbiz/hot-deploy/hello3/servicedef/services.xml
>> 2009-02-05 18:02:59,555 (main) [   GenericDelegator.java:304:ERROR]
>> ---- exception report
>> ----------------------------------------------------------
>> Error getting entity definition from model
>> Exception: org.ofbiz.entity.GenericModelException
>> Message: Could not find definition for entity name hello3.HelloPerson
>> ---- stack trace
>> ---------------------------------------------------------------
>> org.ofbiz.entity.GenericModelException: Could not find definition for
>> entity name hello3.HelloPerson
>> org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader.java:456)
>> org.ofbiz.entity.GenericDelegator.getModelEntity(GenericDelegator.java:3
>> 02)
>> org.ofbiz.service.ModelServiceReader.createAutoAttrDef(ModelServiceReade
>> r.java:480)
>> org.ofbiz.service.ModelServiceReader.createAutoAttrDefs(ModelServiceRead
>> er.java:452)
>> org.ofbiz.service.ModelServiceReader.createModelService(ModelServiceRead
>> er.java:311)
>> org.ofbiz.service.ModelServiceReader.getModelServices(ModelServiceReader
>> .java:166)
>> org.ofbiz.service.ModelServiceReader.<init>(ModelServiceReader.java:100)
>> org.ofbiz.service.ModelServiceReader.getModelServiceMap(ModelServiceRead
>> er.java:81)
>> org.ofbiz.service.DispatchContext.getGlobalServiceMap(DispatchContext.ja
>> va:320)
>> org.ofbiz.service.DispatchContext.loadReaders(DispatchContext.java:79)
>> org.ofbiz.service.GenericDispatcher.init(GenericDispatcher.java:127)
>> org.ofbiz.service.GenericDispatcher.<init>(GenericDispatcher.java:115)
>> org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
>> .java:75)
>> org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
>> .java:39)
>> org.ofbiz.entityext.EntityServiceFactory.getLocalDispatcher(EntityServic
>> eFactory.java:34)
>> org.ofbiz.entityext.EntityServiceFactory.getDispatchContext(EntityServic
>> eFactory.java:39)
>> org.ofbiz.entityext.eca.DelegatorEcaHandler.setDelegator(DelegatorEcaHan
>> dler.java:53)
>> org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:235)
>> org.ofbiz.entity.GenericDelegator.getGenericDelegator(GenericDelegator.j
>> ava:117)
>> org.ofbiz.catalina.container.CatalinaContainer.init(CatalinaContainer.ja
>> va:165)
>> org.ofbiz.base.container.ContainerLoader.loadContainer(ContainerLoader.j
>> ava:141)
>> org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:65)
>> org.ofbiz.base.start.Start.initStartLoaders(Start.java:248)
>> org.ofbiz.base.start.Start.init(Start.java:87)
>> org.ofbiz.base.start.Start.main(Start.java:403)
>
>
>> How to solve this problem or How OFBiz supports multi databases?
>
>> Thank you!
>
>
>> Best Regards,
>
>> Jack Liu
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJiyPGrP3NbaWWqE4RApviAJ474zo7abEYfYqoQsIBpJSdsNuh+ACgs8Cc
G3l45u1OarvhOANyl0IbtwM=
=3urv
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: Urgent! How OFBiz supports multi databases;

BJ Freeman
In reply to this post by Jack Liu-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

to help with the answer why do you want to support multiple databases?


Jack Liu sent the following on 2/5/2009 7:16 AM:

> Thank you for your response!
> But,maybe you didn't catch what I meant
> I knew it could not find definition for entity name hello3.HelloPerson.
> Actually it could not find definition for entity name HelloPerson either.
> So I'am anxious to know how OFBiz supports multi databases.
>
> -----Original Message-----
> From: BJ Freeman [mailto:[hidden email]]
> Sent: 2009年2月5日 18:55
> To: [hidden email]
> Subject: Re: Urgent! How OFBiz supports multi databases;
>
> this is the problem
> Message: Could not find definition for entity name hello3.HelloPerson
>
>
> Jack Liu sent the following on 2/5/2009 2:23 AM:
>> Hi All!
>> First, I add a delegator and a datasource in entity-engine.xml:
>
>> <delegator name="hello3" entity-model-reader="main"
>> entity-group-reader="main" entity-eca-reader="main"
>> distributed-cache-clear-enabled="false">
>>     <group-map group-name="com.aicent"
>> datasource-name="hello3"/>
>>     </delegator>
>
>>     <datasource name="hello3"
>>         helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
>>         field-type-name="mysql"
>>         check-on-start="true"
>>         add-missing-on-start="true"
>>         check-pks-on-start="false"
>>         use-foreign-keys="true"
>>         join-style="ansi-no-parenthesis"
>>         alias-view-columns="false"
>>         drop-fk-use-foreign-key-keyword="true"
>>         table-type="InnoDB"
>>         character-set="latin1"
>>         collate="latin1_general_cs">
>>     <read-data reader-name="seed"/>
>>     <read-data reader-name="demo"/>
>>     <read-data reader-name="ext"/>
>>     <inline-jdbc
>>             jdbc-driver="com.mysql.jdbc.Driver"
>>             jdbc-uri="jdbc:mysql://127.0.0.1/hello"
>>             jdbc-username="root"
>>             jdbc-password="asdfgh"
>>             isolation-level="ReadCommitted"
>>             pool-minsize="2"
>>             pool-maxsize="20"/>
>>     <!-- <jndi-jdbc jndi-server-name="localjndi"
>> jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
>> </datasource>
>
>> Then,in my demo hello3's file entitygroup.xml:
>> <entity-group group="com.aicent" entity="HelloPerson" />
>>      <entity-group group="com.aicent" entity="HelloHobby" />
>>      <entity-group group="com.aicent" entity="HelloPersonHobby" />
>
>> These entities HelloPerson HelloHobby HelloPersonHobby are defined in
>> entitymodel.xml
>
>> In services.xml I define a service named createHelloPerson:
>
>> <service name="createHelloPerson" engine="java"
>> location="org.ofbiz.hello3.Hello3Services"
>> invoke="createHelloPerson">
>> <description>Create a HelloPerson</description>
>> <auto-attributes mode="IN" entity-name="HelloPerson"
>> include="nonpk" optional="true" />
>> <attribute name="helloPersonId" mode="OUT" type="String"
>> optional="false" />
>> </service>
>
>> All other files were well created.
>
>> Then I am starting OFBiz, A error encountered in console.log
>
>> 2009-02-05 18:02:59,540 (main) [UtilXml.java:243:DEBUG] XML Read
>> 0.0s: D:/projects/ofbiz/hot-deploy/hello3/servicedef/services.xml
>> 2009-02-05 18:02:59,555 (main) [   GenericDelegator.java:304:ERROR]
>> ---- exception report
>> ----------------------------------------------------------
>> Error getting entity definition from model
>> Exception: org.ofbiz.entity.GenericModelException
>> Message: Could not find definition for entity name hello3.HelloPerson
>> ---- stack trace
>> ---------------------------------------------------------------
>> org.ofbiz.entity.GenericModelException: Could not find definition for
>> entity name hello3.HelloPerson
>> org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader.java:456)
>> org.ofbiz.entity.GenericDelegator.getModelEntity(GenericDelegator.java:3
>> 02)
>> org.ofbiz.service.ModelServiceReader.createAutoAttrDef(ModelServiceReade
>> r.java:480)
>> org.ofbiz.service.ModelServiceReader.createAutoAttrDefs(ModelServiceRead
>> er.java:452)
>> org.ofbiz.service.ModelServiceReader.createModelService(ModelServiceRead
>> er.java:311)
>> org.ofbiz.service.ModelServiceReader.getModelServices(ModelServiceReader
>> .java:166)
>> org.ofbiz.service.ModelServiceReader.<init>(ModelServiceReader.java:100)
>> org.ofbiz.service.ModelServiceReader.getModelServiceMap(ModelServiceRead
>> er.java:81)
>> org.ofbiz.service.DispatchContext.getGlobalServiceMap(DispatchContext.ja
>> va:320)
>> org.ofbiz.service.DispatchContext.loadReaders(DispatchContext.java:79)
>> org.ofbiz.service.GenericDispatcher.init(GenericDispatcher.java:127)
>> org.ofbiz.service.GenericDispatcher.<init>(GenericDispatcher.java:115)
>> org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
>> .java:75)
>> org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
>> .java:39)
>> org.ofbiz.entityext.EntityServiceFactory.getLocalDispatcher(EntityServic
>> eFactory.java:34)
>> org.ofbiz.entityext.EntityServiceFactory.getDispatchContext(EntityServic
>> eFactory.java:39)
>> org.ofbiz.entityext.eca.DelegatorEcaHandler.setDelegator(DelegatorEcaHan
>> dler.java:53)
>> org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:235)
>> org.ofbiz.entity.GenericDelegator.getGenericDelegator(GenericDelegator.j
>> ava:117)
>> org.ofbiz.catalina.container.CatalinaContainer.init(CatalinaContainer.ja
>> va:165)
>> org.ofbiz.base.container.ContainerLoader.loadContainer(ContainerLoader.j
>> ava:141)
>> org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:65)
>> org.ofbiz.base.start.Start.initStartLoaders(Start.java:248)
>> org.ofbiz.base.start.Start.init(Start.java:87)
>> org.ofbiz.base.start.Start.main(Start.java:403)
>
>
>> How to solve this problem or How OFBiz supports multi databases?
>
>> Thank you!
>
>
>> Best Regards,
>
>> Jack Liu
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJiyWWrP3NbaWWqE4RAoUNAKCXeXilnqQdZP889CUzw5atRBwTlQCffD1B
+TaDe9KGyIONMaVWX4cH4Lc=
=BO4z
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

RE: Urgent! How OFBiz supports multi databases;

Jack Liu-2
In reply to this post by BJ Freeman
Thank you!
OFBiz can't find entity HelloPerson, so I try hello3.HelloPerson.
But it fails too.

There is no problem in the entity engine, I think.
In my entity-engine.xml file, I set up two delegators:default and hello3. Default uses datasource localmysql and hello3 uses datasource hello3.

I start Ofbiz. When it parses file services.xml, it can't tell which delegator entity HelloPerson belongs to and prints error info.

Did I make myself clear?

-----Original Message-----
From: BJ Freeman [mailto:[hidden email]]
Sent: 2009年2月6日 1:37
To: [hidden email]
Subject: Re: Urgent! How OFBiz supports multi databases;

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

the simple answer is yes.
However I don't think what you have in mind is covered under that answer.
your problem of finding an entity has nothing to do with a database.
Think of the database only as a storage medium.
the error your getting is from the entity engine.
it would be wise to re-visit the tutorial and the links on the videos.

http://docs.ofbiz.org/display/OFBIZ/OFBiz+Beginner%27s+Development+Guide+Using+Practice+Application
This will save you having to ask basic questions on the Mailing list and
 speed up you developement.

Jack Liu sent the following on 2/5/2009 7:16 AM:

> Thank you for your response!
> But,maybe you didn't catch what I meant
> I knew it could not find definition for entity name hello3.HelloPerson.
> Actually it could not find definition for entity name HelloPerson either.
> So I'am anxious to know how OFBiz supports multi databases.
>
> -----Original Message-----
> From: BJ Freeman [mailto:[hidden email]]
> Sent: 2009年2月5日 18:55
> To: [hidden email]
> Subject: Re: Urgent! How OFBiz supports multi databases;
>
> this is the problem
> Message: Could not find definition for entity name hello3.HelloPerson
>
>
> Jack Liu sent the following on 2/5/2009 2:23 AM:
>> Hi All!
>> First, I add a delegator and a datasource in entity-engine.xml:
>
>> <delegator name="hello3" entity-model-reader="main"
>> entity-group-reader="main" entity-eca-reader="main"
>> distributed-cache-clear-enabled="false">
>>     <group-map group-name="com.aicent"
>> datasource-name="hello3"/>
>>     </delegator>
>
>>     <datasource name="hello3"
>>         helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
>>         field-type-name="mysql"
>>         check-on-start="true"
>>         add-missing-on-start="true"
>>         check-pks-on-start="false"
>>         use-foreign-keys="true"
>>         join-style="ansi-no-parenthesis"
>>         alias-view-columns="false"
>>         drop-fk-use-foreign-key-keyword="true"
>>         table-type="InnoDB"
>>         character-set="latin1"
>>         collate="latin1_general_cs">
>>     <read-data reader-name="seed"/>
>>     <read-data reader-name="demo"/>
>>     <read-data reader-name="ext"/>
>>     <inline-jdbc
>>             jdbc-driver="com.mysql.jdbc.Driver"
>>             jdbc-uri="jdbc:mysql://127.0.0.1/hello"
>>             jdbc-username="root"
>>             jdbc-password="asdfgh"
>>             isolation-level="ReadCommitted"
>>             pool-minsize="2"
>>             pool-maxsize="20"/>
>>     <!-- <jndi-jdbc jndi-server-name="localjndi"
>> jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
>> </datasource>
>
>> Then,in my demo hello3's file entitygroup.xml:
>> <entity-group group="com.aicent" entity="HelloPerson" />
>>      <entity-group group="com.aicent" entity="HelloHobby" />
>>      <entity-group group="com.aicent" entity="HelloPersonHobby" />
>
>> These entities HelloPerson HelloHobby HelloPersonHobby are defined in
>> entitymodel.xml
>
>> In services.xml I define a service named createHelloPerson:
>
>> <service name="createHelloPerson" engine="java"
>> location="org.ofbiz.hello3.Hello3Services"
>> invoke="createHelloPerson">
>> <description>Create a HelloPerson</description>
>> <auto-attributes mode="IN" entity-name="HelloPerson"
>> include="nonpk" optional="true" />
>> <attribute name="helloPersonId" mode="OUT" type="String"
>> optional="false" />
>> </service>
>
>> All other files were well created.
>
>> Then I am starting OFBiz, A error encountered in console.log
>
>> 2009-02-05 18:02:59,540 (main) [UtilXml.java:243:DEBUG] XML Read
>> 0.0s: D:/projects/ofbiz/hot-deploy/hello3/servicedef/services.xml
>> 2009-02-05 18:02:59,555 (main) [   GenericDelegator.java:304:ERROR]
>> ---- exception report
>> ----------------------------------------------------------
>> Error getting entity definition from model
>> Exception: org.ofbiz.entity.GenericModelException
>> Message: Could not find definition for entity name hello3.HelloPerson
>> ---- stack trace
>> ---------------------------------------------------------------
>> org.ofbiz.entity.GenericModelException: Could not find definition for
>> entity name hello3.HelloPerson
>> org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader.java:456)
>> org.ofbiz.entity.GenericDelegator.getModelEntity(GenericDelegator.java:3
>> 02)
>> org.ofbiz.service.ModelServiceReader.createAutoAttrDef(ModelServiceReade
>> r.java:480)
>> org.ofbiz.service.ModelServiceReader.createAutoAttrDefs(ModelServiceRead
>> er.java:452)
>> org.ofbiz.service.ModelServiceReader.createModelService(ModelServiceRead
>> er.java:311)
>> org.ofbiz.service.ModelServiceReader.getModelServices(ModelServiceReader
>> .java:166)
>> org.ofbiz.service.ModelServiceReader.<init>(ModelServiceReader.java:100)
>> org.ofbiz.service.ModelServiceReader.getModelServiceMap(ModelServiceRead
>> er.java:81)
>> org.ofbiz.service.DispatchContext.getGlobalServiceMap(DispatchContext.ja
>> va:320)
>> org.ofbiz.service.DispatchContext.loadReaders(DispatchContext.java:79)
>> org.ofbiz.service.GenericDispatcher.init(GenericDispatcher.java:127)
>> org.ofbiz.service.GenericDispatcher.<init>(GenericDispatcher.java:115)
>> org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
>> .java:75)
>> org.ofbiz.service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
>> .java:39)
>> org.ofbiz.entityext.EntityServiceFactory.getLocalDispatcher(EntityServic
>> eFactory.java:34)
>> org.ofbiz.entityext.EntityServiceFactory.getDispatchContext(EntityServic
>> eFactory.java:39)
>> org.ofbiz.entityext.eca.DelegatorEcaHandler.setDelegator(DelegatorEcaHan
>> dler.java:53)
>> org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:235)
>> org.ofbiz.entity.GenericDelegator.getGenericDelegator(GenericDelegator.j
>> ava:117)
>> org.ofbiz.catalina.container.CatalinaContainer.init(CatalinaContainer.ja
>> va:165)
>> org.ofbiz.base.container.ContainerLoader.loadContainer(ContainerLoader.j
>> ava:141)
>> org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:65)
>> org.ofbiz.base.start.Start.initStartLoaders(Start.java:248)
>> org.ofbiz.base.start.Start.init(Start.java:87)
>> org.ofbiz.base.start.Start.main(Start.java:403)
>
>
>> How to solve this problem or How OFBiz supports multi databases?
>
>> Thank you!
>
>
>> Best Regards,
>
>> Jack Liu
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJiyPGrP3NbaWWqE4RApviAJ474zo7abEYfYqoQsIBpJSdsNuh+ACgs8Cc
G3l45u1OarvhOANyl0IbtwM=
=3urv
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: Urgent! How OFBiz supports multi databases;

David E Jones-3

It's not totally clear what you're trying to do, just what you've  
done. I'll guess here, but in general it's best to describe:

1. what you did
2. what you expected to happen
3. what actually happened

... and perhaps also your thoughts on the differences between #2 and #3.

I'm guessing you want different tables in different databases. In that  
case, just use one delegator and not two, and have two groups in the  
delegator with the different group-names pointing to different  
datasources.

-David


On Feb 5, 2009, at 6:54 PM, Jack Liu wrote:

> Thank you!
> OFBiz can't find entity HelloPerson, so I try hello3.HelloPerson.
> But it fails too.
>
> There is no problem in the entity engine, I think.
> In my entity-engine.xml file, I set up two delegators:default and  
> hello3. Default uses datasource localmysql and hello3 uses  
> datasource hello3.
>
> I start Ofbiz. When it parses file services.xml, it can't tell which  
> delegator entity HelloPerson belongs to and prints error info.
>
> Did I make myself clear?
>
> -----Original Message-----
> From: BJ Freeman [mailto:[hidden email]]
> Sent: 2009年2月6日 1:37
> To: [hidden email]
> Subject: Re: Urgent! How OFBiz supports multi databases;
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> the simple answer is yes.
> However I don't think what you have in mind is covered under that  
> answer.
> your problem of finding an entity has nothing to do with a database.
> Think of the database only as a storage medium.
> the error your getting is from the entity engine.
> it would be wise to re-visit the tutorial and the links on the videos.
>
> http://docs.ofbiz.org/display/OFBIZ/OFBiz+Beginner%27s+Development+Guide+Using+Practice+Application
> This will save you having to ask basic questions on the Mailing list  
> and
> speed up you developement.
>
> Jack Liu sent the following on 2/5/2009 7:16 AM:
>> Thank you for your response!
>> But,maybe you didn't catch what I meant
>> I knew it could not find definition for entity name  
>> hello3.HelloPerson.
>> Actually it could not find definition for entity name HelloPerson  
>> either.
>> So I'am anxious to know how OFBiz supports multi databases.
>>
>> -----Original Message-----
>> From: BJ Freeman [mailto:[hidden email]]
>> Sent: 2009年2月5日 18:55
>> To: [hidden email]
>> Subject: Re: Urgent! How OFBiz supports multi databases;
>>
>> this is the problem
>> Message: Could not find definition for entity name hello3.HelloPerson
>>
>>
>> Jack Liu sent the following on 2/5/2009 2:23 AM:
>>> Hi All!
>>> First, I add a delegator and a datasource in entity-engine.xml:
>>
>>> <delegator name="hello3" entity-model-reader="main"
>>> entity-group-reader="main" entity-eca-reader="main"
>>> distributed-cache-clear-enabled="false">
>>>     <group-map group-name="com.aicent"
>>> datasource-name="hello3"/>
>>>    </delegator>
>>
>>>    <datasource name="hello3"
>>>        helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
>>>        field-type-name="mysql"
>>>        check-on-start="true"
>>>        add-missing-on-start="true"
>>>        check-pks-on-start="false"
>>>        use-foreign-keys="true"
>>>        join-style="ansi-no-parenthesis"
>>>        alias-view-columns="false"
>>>        drop-fk-use-foreign-key-keyword="true"
>>>        table-type="InnoDB"
>>>        character-set="latin1"
>>>        collate="latin1_general_cs">
>>>    <read-data reader-name="seed"/>
>>>    <read-data reader-name="demo"/>
>>>    <read-data reader-name="ext"/>
>>>    <inline-jdbc
>>>            jdbc-driver="com.mysql.jdbc.Driver"
>>>            jdbc-uri="jdbc:mysql://127.0.0.1/hello"
>>>            jdbc-username="root"
>>>            jdbc-password="asdfgh"
>>>            isolation-level="ReadCommitted"
>>>            pool-minsize="2"
>>>            pool-maxsize="20"/>
>>>    <!-- <jndi-jdbc jndi-server-name="localjndi"
>>> jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/>  
>>> -->
>>> </datasource>
>>
>>> Then,in my demo hello3's file entitygroup.xml:
>>> <entity-group group="com.aicent" entity="HelloPerson" />
>>>     <entity-group group="com.aicent" entity="HelloHobby" />
>>>     <entity-group group="com.aicent" entity="HelloPersonHobby" />
>>
>>> These entities HelloPerson HelloHobby HelloPersonHobby are defined  
>>> in
>>> entitymodel.xml
>>
>>> In services.xml I define a service named createHelloPerson:
>>
>>> <service name="createHelloPerson" engine="java"
>>> location="org.ofbiz.hello3.Hello3Services"
>>> invoke="createHelloPerson">
>>> <description>Create a HelloPerson</description>
>>> <auto-attributes mode="IN" entity-name="HelloPerson"
>>> include="nonpk" optional="true" />
>>> <attribute name="helloPersonId" mode="OUT" type="String"
>>> optional="false" />
>>> </service>
>>
>>> All other files were well created.
>>
>>> Then I am starting OFBiz, A error encountered in console.log
>>
>>> 2009-02-05 18:02:59,540 (main) [UtilXml.java:243:DEBUG] XML Read
>>> 0.0s: D:/projects/ofbiz/hot-deploy/hello3/servicedef/services.xml
>>> 2009-02-05 18:02:59,555 (main) [   GenericDelegator.java:304:ERROR]
>>> ---- exception report
>>> ----------------------------------------------------------
>>> Error getting entity definition from model
>>> Exception: org.ofbiz.entity.GenericModelException
>>> Message: Could not find definition for entity name  
>>> hello3.HelloPerson
>>> ---- stack trace
>>> ---------------------------------------------------------------
>>> org.ofbiz.entity.GenericModelException: Could not find definition  
>>> for
>>> entity name hello3.HelloPerson
>>> org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader.java:
>>> 456)
>>> org
>>> .ofbiz
>>> .entity.GenericDelegator.getModelEntity(GenericDelegator.java:3
>>> 02)
>>> org
>>> .ofbiz
>>> .service.ModelServiceReader.createAutoAttrDef(ModelServiceReade
>>> r.java:480)
>>> org
>>> .ofbiz
>>> .service.ModelServiceReader.createAutoAttrDefs(ModelServiceRead
>>> er.java:452)
>>> org
>>> .ofbiz
>>> .service.ModelServiceReader.createModelService(ModelServiceRead
>>> er.java:311)
>>> org
>>> .ofbiz
>>> .service.ModelServiceReader.getModelServices(ModelServiceReader
>>> .java:166)
>>> org
>>> .ofbiz.service.ModelServiceReader.<init>(ModelServiceReader.java:
>>> 100)
>>> org
>>> .ofbiz
>>> .service.ModelServiceReader.getModelServiceMap(ModelServiceRead
>>> er.java:81)
>>> org
>>> .ofbiz
>>> .service.DispatchContext.getGlobalServiceMap(DispatchContext.ja
>>> va:320)
>>> org.ofbiz.service.DispatchContext.loadReaders(DispatchContext.java:
>>> 79)
>>> org.ofbiz.service.GenericDispatcher.init(GenericDispatcher.java:127)
>>> org.ofbiz.service.GenericDispatcher.<init>(GenericDispatcher.java:
>>> 115)
>>> org
>>> .ofbiz
>>> .service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
>>> .java:75)
>>> org
>>> .ofbiz
>>> .service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
>>> .java:39)
>>> org
>>> .ofbiz
>>> .entityext.EntityServiceFactory.getLocalDispatcher(EntityServic
>>> eFactory.java:34)
>>> org
>>> .ofbiz
>>> .entityext.EntityServiceFactory.getDispatchContext(EntityServic
>>> eFactory.java:39)
>>> org
>>> .ofbiz
>>> .entityext.eca.DelegatorEcaHandler.setDelegator(DelegatorEcaHan
>>> dler.java:53)
>>> org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:235)
>>> org
>>> .ofbiz
>>> .entity.GenericDelegator.getGenericDelegator(GenericDelegator.j
>>> ava:117)
>>> org
>>> .ofbiz
>>> .catalina.container.CatalinaContainer.init(CatalinaContainer.ja
>>> va:165)
>>> org
>>> .ofbiz
>>> .base.container.ContainerLoader.loadContainer(ContainerLoader.j
>>> ava:141)
>>> org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:
>>> 65)
>>> org.ofbiz.base.start.Start.initStartLoaders(Start.java:248)
>>> org.ofbiz.base.start.Start.init(Start.java:87)
>>> org.ofbiz.base.start.Start.main(Start.java:403)
>>
>>
>>> How to solve this problem or How OFBiz supports multi databases?
>>
>>> Thank you!
>>
>>
>>> Best Regards,
>>
>>> Jack Liu
>>
>>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFJiyPGrP3NbaWWqE4RApviAJ474zo7abEYfYqoQsIBpJSdsNuh+ACgs8Cc
> G3l45u1OarvhOANyl0IbtwM=
> =3urv
> -----END PGP SIGNATURE-----

Reply | Threaded
Open this post in threaded view
|

RE: Urgent! How OFBiz supports multi databases;

Jack Liu-2
Thank you for your instructions!

Yes, I want different tables in different databases.
But I don't care one or two delegators.


-----Original Message-----
From: David E Jones [mailto:[hidden email]]
Sent: 2009年2月6日 10:18
To: [hidden email]
Subject: Re: Urgent! How OFBiz supports multi databases;


It's not totally clear what you're trying to do, just what you've  
done. I'll guess here, but in general it's best to describe:

1. what you did
2. what you expected to happen
3. what actually happened

... and perhaps also your thoughts on the differences between #2 and #3.

I'm guessing you want different tables in different databases. In that  
case, just use one delegator and not two, and have two groups in the  
delegator with the different group-names pointing to different  
datasources.

-David


On Feb 5, 2009, at 6:54 PM, Jack Liu wrote:

> Thank you!
> OFBiz can't find entity HelloPerson, so I try hello3.HelloPerson.
> But it fails too.
>
> There is no problem in the entity engine, I think.
> In my entity-engine.xml file, I set up two delegators:default and  
> hello3. Default uses datasource localmysql and hello3 uses  
> datasource hello3.
>
> I start Ofbiz. When it parses file services.xml, it can't tell which  
> delegator entity HelloPerson belongs to and prints error info.
>
> Did I make myself clear?
>
> -----Original Message-----
> From: BJ Freeman [mailto:[hidden email]]
> Sent: 2009年2月6日 1:37
> To: [hidden email]
> Subject: Re: Urgent! How OFBiz supports multi databases;
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> the simple answer is yes.
> However I don't think what you have in mind is covered under that  
> answer.
> your problem of finding an entity has nothing to do with a database.
> Think of the database only as a storage medium.
> the error your getting is from the entity engine.
> it would be wise to re-visit the tutorial and the links on the videos.
>
> http://docs.ofbiz.org/display/OFBIZ/OFBiz+Beginner%27s+Development+Guide+Using+Practice+Application
> This will save you having to ask basic questions on the Mailing list  
> and
> speed up you developement.
>
> Jack Liu sent the following on 2/5/2009 7:16 AM:
>> Thank you for your response!
>> But,maybe you didn't catch what I meant
>> I knew it could not find definition for entity name  
>> hello3.HelloPerson.
>> Actually it could not find definition for entity name HelloPerson  
>> either.
>> So I'am anxious to know how OFBiz supports multi databases.
>>
>> -----Original Message-----
>> From: BJ Freeman [mailto:[hidden email]]
>> Sent: 2009年2月5日 18:55
>> To: [hidden email]
>> Subject: Re: Urgent! How OFBiz supports multi databases;
>>
>> this is the problem
>> Message: Could not find definition for entity name hello3.HelloPerson
>>
>>
>> Jack Liu sent the following on 2/5/2009 2:23 AM:
>>> Hi All!
>>> First, I add a delegator and a datasource in entity-engine.xml:
>>
>>> <delegator name="hello3" entity-model-reader="main"
>>> entity-group-reader="main" entity-eca-reader="main"
>>> distributed-cache-clear-enabled="false">
>>>     <group-map group-name="com.aicent"
>>> datasource-name="hello3"/>
>>>    </delegator>
>>
>>>    <datasource name="hello3"
>>>        helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
>>>        field-type-name="mysql"
>>>        check-on-start="true"
>>>        add-missing-on-start="true"
>>>        check-pks-on-start="false"
>>>        use-foreign-keys="true"
>>>        join-style="ansi-no-parenthesis"
>>>        alias-view-columns="false"
>>>        drop-fk-use-foreign-key-keyword="true"
>>>        table-type="InnoDB"
>>>        character-set="latin1"
>>>        collate="latin1_general_cs">
>>>    <read-data reader-name="seed"/>
>>>    <read-data reader-name="demo"/>
>>>    <read-data reader-name="ext"/>
>>>    <inline-jdbc
>>>            jdbc-driver="com.mysql.jdbc.Driver"
>>>            jdbc-uri="jdbc:mysql://127.0.0.1/hello"
>>>            jdbc-username="root"
>>>            jdbc-password="asdfgh"
>>>            isolation-level="ReadCommitted"
>>>            pool-minsize="2"
>>>            pool-maxsize="20"/>
>>>    <!-- <jndi-jdbc jndi-server-name="localjndi"
>>> jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/>  
>>> -->
>>> </datasource>
>>
>>> Then,in my demo hello3's file entitygroup.xml:
>>> <entity-group group="com.aicent" entity="HelloPerson" />
>>>     <entity-group group="com.aicent" entity="HelloHobby" />
>>>     <entity-group group="com.aicent" entity="HelloPersonHobby" />
>>
>>> These entities HelloPerson HelloHobby HelloPersonHobby are defined  
>>> in
>>> entitymodel.xml
>>
>>> In services.xml I define a service named createHelloPerson:
>>
>>> <service name="createHelloPerson" engine="java"
>>> location="org.ofbiz.hello3.Hello3Services"
>>> invoke="createHelloPerson">
>>> <description>Create a HelloPerson</description>
>>> <auto-attributes mode="IN" entity-name="HelloPerson"
>>> include="nonpk" optional="true" />
>>> <attribute name="helloPersonId" mode="OUT" type="String"
>>> optional="false" />
>>> </service>
>>
>>> All other files were well created.
>>
>>> Then I am starting OFBiz, A error encountered in console.log
>>
>>> 2009-02-05 18:02:59,540 (main) [UtilXml.java:243:DEBUG] XML Read
>>> 0.0s: D:/projects/ofbiz/hot-deploy/hello3/servicedef/services.xml
>>> 2009-02-05 18:02:59,555 (main) [   GenericDelegator.java:304:ERROR]
>>> ---- exception report
>>> ----------------------------------------------------------
>>> Error getting entity definition from model
>>> Exception: org.ofbiz.entity.GenericModelException
>>> Message: Could not find definition for entity name  
>>> hello3.HelloPerson
>>> ---- stack trace
>>> ---------------------------------------------------------------
>>> org.ofbiz.entity.GenericModelException: Could not find definition  
>>> for
>>> entity name hello3.HelloPerson
>>> org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader.java:
>>> 456)
>>> org
>>> .ofbiz
>>> .entity.GenericDelegator.getModelEntity(GenericDelegator.java:3
>>> 02)
>>> org
>>> .ofbiz
>>> .service.ModelServiceReader.createAutoAttrDef(ModelServiceReade
>>> r.java:480)
>>> org
>>> .ofbiz
>>> .service.ModelServiceReader.createAutoAttrDefs(ModelServiceRead
>>> er.java:452)
>>> org
>>> .ofbiz
>>> .service.ModelServiceReader.createModelService(ModelServiceRead
>>> er.java:311)
>>> org
>>> .ofbiz
>>> .service.ModelServiceReader.getModelServices(ModelServiceReader
>>> .java:166)
>>> org
>>> .ofbiz.service.ModelServiceReader.<init>(ModelServiceReader.java:
>>> 100)
>>> org
>>> .ofbiz
>>> .service.ModelServiceReader.getModelServiceMap(ModelServiceRead
>>> er.java:81)
>>> org
>>> .ofbiz
>>> .service.DispatchContext.getGlobalServiceMap(DispatchContext.ja
>>> va:320)
>>> org.ofbiz.service.DispatchContext.loadReaders(DispatchContext.java:
>>> 79)
>>> org.ofbiz.service.GenericDispatcher.init(GenericDispatcher.java:127)
>>> org.ofbiz.service.GenericDispatcher.<init>(GenericDispatcher.java:
>>> 115)
>>> org
>>> .ofbiz
>>> .service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
>>> .java:75)
>>> org
>>> .ofbiz
>>> .service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
>>> .java:39)
>>> org
>>> .ofbiz
>>> .entityext.EntityServiceFactory.getLocalDispatcher(EntityServic
>>> eFactory.java:34)
>>> org
>>> .ofbiz
>>> .entityext.EntityServiceFactory.getDispatchContext(EntityServic
>>> eFactory.java:39)
>>> org
>>> .ofbiz
>>> .entityext.eca.DelegatorEcaHandler.setDelegator(DelegatorEcaHan
>>> dler.java:53)
>>> org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:235)
>>> org
>>> .ofbiz
>>> .entity.GenericDelegator.getGenericDelegator(GenericDelegator.j
>>> ava:117)
>>> org
>>> .ofbiz
>>> .catalina.container.CatalinaContainer.init(CatalinaContainer.ja
>>> va:165)
>>> org
>>> .ofbiz
>>> .base.container.ContainerLoader.loadContainer(ContainerLoader.j
>>> ava:141)
>>> org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:
>>> 65)
>>> org.ofbiz.base.start.Start.initStartLoaders(Start.java:248)
>>> org.ofbiz.base.start.Start.init(Start.java:87)
>>> org.ofbiz.base.start.Start.main(Start.java:403)
>>
>>
>>> How to solve this problem or How OFBiz supports multi databases?
>>
>>> Thank you!
>>
>>
>>> Best Regards,
>>
>>> Jack Liu
>>
>>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFJiyPGrP3NbaWWqE4RApviAJ474zo7abEYfYqoQsIBpJSdsNuh+ACgs8Cc
> G3l45u1OarvhOANyl0IbtwM=
> =3urv
> -----END PGP SIGNATURE-----

Reply | Threaded
Open this post in threaded view
|

Re: Urgent! How OFBiz supports multi databases;

David E Jones-3

It sounds like you DO care about one or two delegators, and the answer  
is you want one.

-David


On Feb 5, 2009, at 7:24 PM, Jack Liu wrote:

> Thank you for your instructions!
>
> Yes, I want different tables in different databases.
> But I don't care one or two delegators.
>
>
> -----Original Message-----
> From: David E Jones [mailto:[hidden email]]
> Sent: 2009年2月6日 10:18
> To: [hidden email]
> Subject: Re: Urgent! How OFBiz supports multi databases;
>
>
> It's not totally clear what you're trying to do, just what you've
> done. I'll guess here, but in general it's best to describe:
>
> 1. what you did
> 2. what you expected to happen
> 3. what actually happened
>
> ... and perhaps also your thoughts on the differences between #2 and  
> #3.
>
> I'm guessing you want different tables in different databases. In that
> case, just use one delegator and not two, and have two groups in the
> delegator with the different group-names pointing to different
> datasources.
>
> -David
>
>
> On Feb 5, 2009, at 6:54 PM, Jack Liu wrote:
>
>> Thank you!
>> OFBiz can't find entity HelloPerson, so I try hello3.HelloPerson.
>> But it fails too.
>>
>> There is no problem in the entity engine, I think.
>> In my entity-engine.xml file, I set up two delegators:default and
>> hello3. Default uses datasource localmysql and hello3 uses
>> datasource hello3.
>>
>> I start Ofbiz. When it parses file services.xml, it can't tell which
>> delegator entity HelloPerson belongs to and prints error info.
>>
>> Did I make myself clear?
>>
>> -----Original Message-----
>> From: BJ Freeman [mailto:[hidden email]]
>> Sent: 2009年2月6日 1:37
>> To: [hidden email]
>> Subject: Re: Urgent! How OFBiz supports multi databases;
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> the simple answer is yes.
>> However I don't think what you have in mind is covered under that
>> answer.
>> your problem of finding an entity has nothing to do with a database.
>> Think of the database only as a storage medium.
>> the error your getting is from the entity engine.
>> it would be wise to re-visit the tutorial and the links on the  
>> videos.
>>
>> http://docs.ofbiz.org/display/OFBIZ/OFBiz+Beginner%27s+Development+Guide+Using+Practice+Application
>> This will save you having to ask basic questions on the Mailing list
>> and
>> speed up you developement.
>>
>> Jack Liu sent the following on 2/5/2009 7:16 AM:
>>> Thank you for your response!
>>> But,maybe you didn't catch what I meant
>>> I knew it could not find definition for entity name
>>> hello3.HelloPerson.
>>> Actually it could not find definition for entity name HelloPerson
>>> either.
>>> So I'am anxious to know how OFBiz supports multi databases.
>>>
>>> -----Original Message-----
>>> From: BJ Freeman [mailto:[hidden email]]
>>> Sent: 2009年2月5日 18:55
>>> To: [hidden email]
>>> Subject: Re: Urgent! How OFBiz supports multi databases;
>>>
>>> this is the problem
>>> Message: Could not find definition for entity name  
>>> hello3.HelloPerson
>>>
>>>
>>> Jack Liu sent the following on 2/5/2009 2:23 AM:
>>>> Hi All!
>>>> First, I add a delegator and a datasource in entity-engine.xml:
>>>
>>>> <delegator name="hello3" entity-model-reader="main"
>>>> entity-group-reader="main" entity-eca-reader="main"
>>>> distributed-cache-clear-enabled="false">
>>>>   <group-map group-name="com.aicent"
>>>> datasource-name="hello3"/>
>>>>   </delegator>
>>>
>>>>   <datasource name="hello3"
>>>>       helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
>>>>       field-type-name="mysql"
>>>>       check-on-start="true"
>>>>       add-missing-on-start="true"
>>>>       check-pks-on-start="false"
>>>>       use-foreign-keys="true"
>>>>       join-style="ansi-no-parenthesis"
>>>>       alias-view-columns="false"
>>>>       drop-fk-use-foreign-key-keyword="true"
>>>>       table-type="InnoDB"
>>>>       character-set="latin1"
>>>>       collate="latin1_general_cs">
>>>>   <read-data reader-name="seed"/>
>>>>   <read-data reader-name="demo"/>
>>>>   <read-data reader-name="ext"/>
>>>>   <inline-jdbc
>>>>           jdbc-driver="com.mysql.jdbc.Driver"
>>>>           jdbc-uri="jdbc:mysql://127.0.0.1/hello"
>>>>           jdbc-username="root"
>>>>           jdbc-password="asdfgh"
>>>>           isolation-level="ReadCommitted"
>>>>           pool-minsize="2"
>>>>           pool-maxsize="20"/>
>>>>   <!-- <jndi-jdbc jndi-server-name="localjndi"
>>>> jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/>
>>>> -->
>>>> </datasource>
>>>
>>>> Then,in my demo hello3's file entitygroup.xml:
>>>> <entity-group group="com.aicent" entity="HelloPerson" />
>>>>    <entity-group group="com.aicent" entity="HelloHobby" />
>>>>    <entity-group group="com.aicent" entity="HelloPersonHobby" />
>>>
>>>> These entities HelloPerson HelloHobby HelloPersonHobby are defined
>>>> in
>>>> entitymodel.xml
>>>
>>>> In services.xml I define a service named createHelloPerson:
>>>
>>>> <service name="createHelloPerson" engine="java"
>>>> location="org.ofbiz.hello3.Hello3Services"
>>>> invoke="createHelloPerson">
>>>> <description>Create a HelloPerson</description>
>>>> <auto-attributes mode="IN" entity-name="HelloPerson"
>>>> include="nonpk" optional="true" />
>>>> <attribute name="helloPersonId" mode="OUT" type="String"
>>>> optional="false" />
>>>> </service>
>>>
>>>> All other files were well created.
>>>
>>>> Then I am starting OFBiz, A error encountered in console.log
>>>
>>>> 2009-02-05 18:02:59,540 (main) [UtilXml.java:243:DEBUG] XML Read
>>>> 0.0s: D:/projects/ofbiz/hot-deploy/hello3/servicedef/services.xml
>>>> 2009-02-05 18:02:59,555 (main) [   GenericDelegator.java:304:ERROR]
>>>> ---- exception report
>>>> ----------------------------------------------------------
>>>> Error getting entity definition from model
>>>> Exception: org.ofbiz.entity.GenericModelException
>>>> Message: Could not find definition for entity name
>>>> hello3.HelloPerson
>>>> ---- stack trace
>>>> ---------------------------------------------------------------
>>>> org.ofbiz.entity.GenericModelException: Could not find definition
>>>> for
>>>> entity name hello3.HelloPerson
>>>> org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader.java:
>>>> 456)
>>>> org
>>>> .ofbiz
>>>> .entity.GenericDelegator.getModelEntity(GenericDelegator.java:3
>>>> 02)
>>>> org
>>>> .ofbiz
>>>> .service.ModelServiceReader.createAutoAttrDef(ModelServiceReade
>>>> r.java:480)
>>>> org
>>>> .ofbiz
>>>> .service.ModelServiceReader.createAutoAttrDefs(ModelServiceRead
>>>> er.java:452)
>>>> org
>>>> .ofbiz
>>>> .service.ModelServiceReader.createModelService(ModelServiceRead
>>>> er.java:311)
>>>> org
>>>> .ofbiz
>>>> .service.ModelServiceReader.getModelServices(ModelServiceReader
>>>> .java:166)
>>>> org
>>>> .ofbiz.service.ModelServiceReader.<init>(ModelServiceReader.java:
>>>> 100)
>>>> org
>>>> .ofbiz
>>>> .service.ModelServiceReader.getModelServiceMap(ModelServiceRead
>>>> er.java:81)
>>>> org
>>>> .ofbiz
>>>> .service.DispatchContext.getGlobalServiceMap(DispatchContext.ja
>>>> va:320)
>>>> org.ofbiz.service.DispatchContext.loadReaders(DispatchContext.java:
>>>> 79)
>>>> org.ofbiz.service.GenericDispatcher.init(GenericDispatcher.java:
>>>> 127)
>>>> org.ofbiz.service.GenericDispatcher.<init>(GenericDispatcher.java:
>>>> 115)
>>>> org
>>>> .ofbiz
>>>> .service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
>>>> .java:75)
>>>> org
>>>> .ofbiz
>>>> .service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
>>>> .java:39)
>>>> org
>>>> .ofbiz
>>>> .entityext.EntityServiceFactory.getLocalDispatcher(EntityServic
>>>> eFactory.java:34)
>>>> org
>>>> .ofbiz
>>>> .entityext.EntityServiceFactory.getDispatchContext(EntityServic
>>>> eFactory.java:39)
>>>> org
>>>> .ofbiz
>>>> .entityext.eca.DelegatorEcaHandler.setDelegator(DelegatorEcaHan
>>>> dler.java:53)
>>>> org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:235)
>>>> org
>>>> .ofbiz
>>>> .entity.GenericDelegator.getGenericDelegator(GenericDelegator.j
>>>> ava:117)
>>>> org
>>>> .ofbiz
>>>> .catalina.container.CatalinaContainer.init(CatalinaContainer.ja
>>>> va:165)
>>>> org
>>>> .ofbiz
>>>> .base.container.ContainerLoader.loadContainer(ContainerLoader.j
>>>> ava:141)
>>>> org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:
>>>> 65)
>>>> org.ofbiz.base.start.Start.initStartLoaders(Start.java:248)
>>>> org.ofbiz.base.start.Start.init(Start.java:87)
>>>> org.ofbiz.base.start.Start.main(Start.java:403)
>>>
>>>
>>>> How to solve this problem or How OFBiz supports multi databases?
>>>
>>>> Thank you!
>>>
>>>
>>>> Best Regards,
>>>
>>>> Jack Liu
>>>
>>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.6 (MingW32)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>
>> iD8DBQFJiyPGrP3NbaWWqE4RApviAJ474zo7abEYfYqoQsIBpJSdsNuh+ACgs8Cc
>> G3l45u1OarvhOANyl0IbtwM=
>> =3urv
>> -----END PGP SIGNATURE-----
>

Reply | Threaded
Open this post in threaded view
|

RE: Urgent! How OFBiz supports multi databases;

Jack Liu-2
Just now I tried according to you suggestion.
I use default delegator and have two groups in the delegator with the different group-names pointing to different data sources.
It works!

I had thought I should have set up two delegators supporting two or more databases;

Thank you very much, you help me a lot!



-----Original Message-----
From: David E Jones [mailto:[hidden email]]
Sent: 2009年2月6日 10:46
To: [hidden email]
Subject: Re: Urgent! How OFBiz supports multi databases;


It sounds like you DO care about one or two delegators, and the answer  
is you want one.

-David


On Feb 5, 2009, at 7:24 PM, Jack Liu wrote:

> Thank you for your instructions!
>
> Yes, I want different tables in different databases.
> But I don't care one or two delegators.
>
>
> -----Original Message-----
> From: David E Jones [mailto:[hidden email]]
> Sent: 2009年2月6日 10:18
> To: [hidden email]
> Subject: Re: Urgent! How OFBiz supports multi databases;
>
>
> It's not totally clear what you're trying to do, just what you've
> done. I'll guess here, but in general it's best to describe:
>
> 1. what you did
> 2. what you expected to happen
> 3. what actually happened
>
> ... and perhaps also your thoughts on the differences between #2 and  
> #3.
>
> I'm guessing you want different tables in different databases. In that
> case, just use one delegator and not two, and have two groups in the
> delegator with the different group-names pointing to different
> datasources.
>
> -David
>
>
> On Feb 5, 2009, at 6:54 PM, Jack Liu wrote:
>
>> Thank you!
>> OFBiz can't find entity HelloPerson, so I try hello3.HelloPerson.
>> But it fails too.
>>
>> There is no problem in the entity engine, I think.
>> In my entity-engine.xml file, I set up two delegators:default and
>> hello3. Default uses datasource localmysql and hello3 uses
>> datasource hello3.
>>
>> I start Ofbiz. When it parses file services.xml, it can't tell which
>> delegator entity HelloPerson belongs to and prints error info.
>>
>> Did I make myself clear?
>>
>> -----Original Message-----
>> From: BJ Freeman [mailto:[hidden email]]
>> Sent: 2009年2月6日 1:37
>> To: [hidden email]
>> Subject: Re: Urgent! How OFBiz supports multi databases;
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> the simple answer is yes.
>> However I don't think what you have in mind is covered under that
>> answer.
>> your problem of finding an entity has nothing to do with a database.
>> Think of the database only as a storage medium.
>> the error your getting is from the entity engine.
>> it would be wise to re-visit the tutorial and the links on the  
>> videos.
>>
>> http://docs.ofbiz.org/display/OFBIZ/OFBiz+Beginner%27s+Development+Guide+Using+Practice+Application
>> This will save you having to ask basic questions on the Mailing list
>> and
>> speed up you developement.
>>
>> Jack Liu sent the following on 2/5/2009 7:16 AM:
>>> Thank you for your response!
>>> But,maybe you didn't catch what I meant
>>> I knew it could not find definition for entity name
>>> hello3.HelloPerson.
>>> Actually it could not find definition for entity name HelloPerson
>>> either.
>>> So I'am anxious to know how OFBiz supports multi databases.
>>>
>>> -----Original Message-----
>>> From: BJ Freeman [mailto:[hidden email]]
>>> Sent: 2009年2月5日 18:55
>>> To: [hidden email]
>>> Subject: Re: Urgent! How OFBiz supports multi databases;
>>>
>>> this is the problem
>>> Message: Could not find definition for entity name  
>>> hello3.HelloPerson
>>>
>>>
>>> Jack Liu sent the following on 2/5/2009 2:23 AM:
>>>> Hi All!
>>>> First, I add a delegator and a datasource in entity-engine.xml:
>>>
>>>> <delegator name="hello3" entity-model-reader="main"
>>>> entity-group-reader="main" entity-eca-reader="main"
>>>> distributed-cache-clear-enabled="false">
>>>>   <group-map group-name="com.aicent"
>>>> datasource-name="hello3"/>
>>>>   </delegator>
>>>
>>>>   <datasource name="hello3"
>>>>       helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
>>>>       field-type-name="mysql"
>>>>       check-on-start="true"
>>>>       add-missing-on-start="true"
>>>>       check-pks-on-start="false"
>>>>       use-foreign-keys="true"
>>>>       join-style="ansi-no-parenthesis"
>>>>       alias-view-columns="false"
>>>>       drop-fk-use-foreign-key-keyword="true"
>>>>       table-type="InnoDB"
>>>>       character-set="latin1"
>>>>       collate="latin1_general_cs">
>>>>   <read-data reader-name="seed"/>
>>>>   <read-data reader-name="demo"/>
>>>>   <read-data reader-name="ext"/>
>>>>   <inline-jdbc
>>>>           jdbc-driver="com.mysql.jdbc.Driver"
>>>>           jdbc-uri="jdbc:mysql://127.0.0.1/hello"
>>>>           jdbc-username="root"
>>>>           jdbc-password="asdfgh"
>>>>           isolation-level="ReadCommitted"
>>>>           pool-minsize="2"
>>>>           pool-maxsize="20"/>
>>>>   <!-- <jndi-jdbc jndi-server-name="localjndi"
>>>> jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/>
>>>> -->
>>>> </datasource>
>>>
>>>> Then,in my demo hello3's file entitygroup.xml:
>>>> <entity-group group="com.aicent" entity="HelloPerson" />
>>>>    <entity-group group="com.aicent" entity="HelloHobby" />
>>>>    <entity-group group="com.aicent" entity="HelloPersonHobby" />
>>>
>>>> These entities HelloPerson HelloHobby HelloPersonHobby are defined
>>>> in
>>>> entitymodel.xml
>>>
>>>> In services.xml I define a service named createHelloPerson:
>>>
>>>> <service name="createHelloPerson" engine="java"
>>>> location="org.ofbiz.hello3.Hello3Services"
>>>> invoke="createHelloPerson">
>>>> <description>Create a HelloPerson</description>
>>>> <auto-attributes mode="IN" entity-name="HelloPerson"
>>>> include="nonpk" optional="true" />
>>>> <attribute name="helloPersonId" mode="OUT" type="String"
>>>> optional="false" />
>>>> </service>
>>>
>>>> All other files were well created.
>>>
>>>> Then I am starting OFBiz, A error encountered in console.log
>>>
>>>> 2009-02-05 18:02:59,540 (main) [UtilXml.java:243:DEBUG] XML Read
>>>> 0.0s: D:/projects/ofbiz/hot-deploy/hello3/servicedef/services.xml
>>>> 2009-02-05 18:02:59,555 (main) [   GenericDelegator.java:304:ERROR]
>>>> ---- exception report
>>>> ----------------------------------------------------------
>>>> Error getting entity definition from model
>>>> Exception: org.ofbiz.entity.GenericModelException
>>>> Message: Could not find definition for entity name
>>>> hello3.HelloPerson
>>>> ---- stack trace
>>>> ---------------------------------------------------------------
>>>> org.ofbiz.entity.GenericModelException: Could not find definition
>>>> for
>>>> entity name hello3.HelloPerson
>>>> org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader.java:
>>>> 456)
>>>> org
>>>> .ofbiz
>>>> .entity.GenericDelegator.getModelEntity(GenericDelegator.java:3
>>>> 02)
>>>> org
>>>> .ofbiz
>>>> .service.ModelServiceReader.createAutoAttrDef(ModelServiceReade
>>>> r.java:480)
>>>> org
>>>> .ofbiz
>>>> .service.ModelServiceReader.createAutoAttrDefs(ModelServiceRead
>>>> er.java:452)
>>>> org
>>>> .ofbiz
>>>> .service.ModelServiceReader.createModelService(ModelServiceRead
>>>> er.java:311)
>>>> org
>>>> .ofbiz
>>>> .service.ModelServiceReader.getModelServices(ModelServiceReader
>>>> .java:166)
>>>> org
>>>> .ofbiz.service.ModelServiceReader.<init>(ModelServiceReader.java:
>>>> 100)
>>>> org
>>>> .ofbiz
>>>> .service.ModelServiceReader.getModelServiceMap(ModelServiceRead
>>>> er.java:81)
>>>> org
>>>> .ofbiz
>>>> .service.DispatchContext.getGlobalServiceMap(DispatchContext.ja
>>>> va:320)
>>>> org.ofbiz.service.DispatchContext.loadReaders(DispatchContext.java:
>>>> 79)
>>>> org.ofbiz.service.GenericDispatcher.init(GenericDispatcher.java:
>>>> 127)
>>>> org.ofbiz.service.GenericDispatcher.<init>(GenericDispatcher.java:
>>>> 115)
>>>> org
>>>> .ofbiz
>>>> .service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
>>>> .java:75)
>>>> org
>>>> .ofbiz
>>>> .service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
>>>> .java:39)
>>>> org
>>>> .ofbiz
>>>> .entityext.EntityServiceFactory.getLocalDispatcher(EntityServic
>>>> eFactory.java:34)
>>>> org
>>>> .ofbiz
>>>> .entityext.EntityServiceFactory.getDispatchContext(EntityServic
>>>> eFactory.java:39)
>>>> org
>>>> .ofbiz
>>>> .entityext.eca.DelegatorEcaHandler.setDelegator(DelegatorEcaHan
>>>> dler.java:53)
>>>> org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:235)
>>>> org
>>>> .ofbiz
>>>> .entity.GenericDelegator.getGenericDelegator(GenericDelegator.j
>>>> ava:117)
>>>> org
>>>> .ofbiz
>>>> .catalina.container.CatalinaContainer.init(CatalinaContainer.ja
>>>> va:165)
>>>> org
>>>> .ofbiz
>>>> .base.container.ContainerLoader.loadContainer(ContainerLoader.j
>>>> ava:141)
>>>> org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:
>>>> 65)
>>>> org.ofbiz.base.start.Start.initStartLoaders(Start.java:248)
>>>> org.ofbiz.base.start.Start.init(Start.java:87)
>>>> org.ofbiz.base.start.Start.main(Start.java:403)
>>>
>>>
>>>> How to solve this problem or How OFBiz supports multi databases?
>>>
>>>> Thank you!
>>>
>>>
>>>> Best Regards,
>>>
>>>> Jack Liu
>>>
>>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.6 (MingW32)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>
>> iD8DBQFJiyPGrP3NbaWWqE4RApviAJ474zo7abEYfYqoQsIBpJSdsNuh+ACgs8Cc
>> G3l45u1OarvhOANyl0IbtwM=
>> =3urv
>> -----END PGP SIGNATURE-----
>

Reply | Threaded
Open this post in threaded view
|

Re: Urgent! How OFBiz supports multi databases;

David E Jones-3

I hate to say it, but:

http://docs.ofbiz.org/display/OFBADMIN/OFBiz+Documentation+Index
http://ofbiz.apache.org/docs/entityconfig.html

-David


On Feb 5, 2009, at 7:53 PM, Jack Liu wrote:

> Just now I tried according to you suggestion.
> I use default delegator and have two groups in the delegator with  
> the different group-names pointing to different data sources.
> It works!
>
> I had thought I should have set up two delegators supporting two or  
> more databases;
>
> Thank you very much, you help me a lot!
>
>
>
> -----Original Message-----
> From: David E Jones [mailto:[hidden email]]
> Sent: 2009年2月6日 10:46
> To: [hidden email]
> Subject: Re: Urgent! How OFBiz supports multi databases;
>
>
> It sounds like you DO care about one or two delegators, and the answer
> is you want one.
>
> -David
>
>
> On Feb 5, 2009, at 7:24 PM, Jack Liu wrote:
>
>> Thank you for your instructions!
>>
>> Yes, I want different tables in different databases.
>> But I don't care one or two delegators.
>>
>>
>> -----Original Message-----
>> From: David E Jones [mailto:[hidden email]]
>> Sent: 2009年2月6日 10:18
>> To: [hidden email]
>> Subject: Re: Urgent! How OFBiz supports multi databases;
>>
>>
>> It's not totally clear what you're trying to do, just what you've
>> done. I'll guess here, but in general it's best to describe:
>>
>> 1. what you did
>> 2. what you expected to happen
>> 3. what actually happened
>>
>> ... and perhaps also your thoughts on the differences between #2 and
>> #3.
>>
>> I'm guessing you want different tables in different databases. In  
>> that
>> case, just use one delegator and not two, and have two groups in the
>> delegator with the different group-names pointing to different
>> datasources.
>>
>> -David
>>
>>
>> On Feb 5, 2009, at 6:54 PM, Jack Liu wrote:
>>
>>> Thank you!
>>> OFBiz can't find entity HelloPerson, so I try hello3.HelloPerson.
>>> But it fails too.
>>>
>>> There is no problem in the entity engine, I think.
>>> In my entity-engine.xml file, I set up two delegators:default and
>>> hello3. Default uses datasource localmysql and hello3 uses
>>> datasource hello3.
>>>
>>> I start Ofbiz. When it parses file services.xml, it can't tell which
>>> delegator entity HelloPerson belongs to and prints error info.
>>>
>>> Did I make myself clear?
>>>
>>> -----Original Message-----
>>> From: BJ Freeman [mailto:[hidden email]]
>>> Sent: 2009年2月6日 1:37
>>> To: [hidden email]
>>> Subject: Re: Urgent! How OFBiz supports multi databases;
>>>
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> the simple answer is yes.
>>> However I don't think what you have in mind is covered under that
>>> answer.
>>> your problem of finding an entity has nothing to do with a database.
>>> Think of the database only as a storage medium.
>>> the error your getting is from the entity engine.
>>> it would be wise to re-visit the tutorial and the links on the
>>> videos.
>>>
>>> http://docs.ofbiz.org/display/OFBIZ/OFBiz+Beginner%27s+Development+Guide+Using+Practice+Application
>>> This will save you having to ask basic questions on the Mailing list
>>> and
>>> speed up you developement.
>>>
>>> Jack Liu sent the following on 2/5/2009 7:16 AM:
>>>> Thank you for your response!
>>>> But,maybe you didn't catch what I meant
>>>> I knew it could not find definition for entity name
>>>> hello3.HelloPerson.
>>>> Actually it could not find definition for entity name HelloPerson
>>>> either.
>>>> So I'am anxious to know how OFBiz supports multi databases.
>>>>
>>>> -----Original Message-----
>>>> From: BJ Freeman [mailto:[hidden email]]
>>>> Sent: 2009年2月5日 18:55
>>>> To: [hidden email]
>>>> Subject: Re: Urgent! How OFBiz supports multi databases;
>>>>
>>>> this is the problem
>>>> Message: Could not find definition for entity name
>>>> hello3.HelloPerson
>>>>
>>>>
>>>> Jack Liu sent the following on 2/5/2009 2:23 AM:
>>>>> Hi All!
>>>>> First, I add a delegator and a datasource in entity-engine.xml:
>>>>
>>>>> <delegator name="hello3" entity-model-reader="main"
>>>>> entity-group-reader="main" entity-eca-reader="main"
>>>>> distributed-cache-clear-enabled="false">
>>>>>   <group-map group-name="com.aicent"
>>>>> datasource-name="hello3"/>
>>>>>  </delegator>
>>>>
>>>>>  <datasource name="hello3"
>>>>>      helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
>>>>>      field-type-name="mysql"
>>>>>      check-on-start="true"
>>>>>      add-missing-on-start="true"
>>>>>      check-pks-on-start="false"
>>>>>      use-foreign-keys="true"
>>>>>      join-style="ansi-no-parenthesis"
>>>>>      alias-view-columns="false"
>>>>>      drop-fk-use-foreign-key-keyword="true"
>>>>>      table-type="InnoDB"
>>>>>      character-set="latin1"
>>>>>      collate="latin1_general_cs">
>>>>>  <read-data reader-name="seed"/>
>>>>>  <read-data reader-name="demo"/>
>>>>>  <read-data reader-name="ext"/>
>>>>>  <inline-jdbc
>>>>>          jdbc-driver="com.mysql.jdbc.Driver"
>>>>>          jdbc-uri="jdbc:mysql://127.0.0.1/hello"
>>>>>          jdbc-username="root"
>>>>>          jdbc-password="asdfgh"
>>>>>          isolation-level="ReadCommitted"
>>>>>          pool-minsize="2"
>>>>>          pool-maxsize="20"/>
>>>>>  <!-- <jndi-jdbc jndi-server-name="localjndi"
>>>>> jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/>
>>>>> -->
>>>>> </datasource>
>>>>
>>>>> Then,in my demo hello3's file entitygroup.xml:
>>>>> <entity-group group="com.aicent" entity="HelloPerson" />
>>>>>   <entity-group group="com.aicent" entity="HelloHobby" />
>>>>>   <entity-group group="com.aicent" entity="HelloPersonHobby" />
>>>>
>>>>> These entities HelloPerson HelloHobby HelloPersonHobby are defined
>>>>> in
>>>>> entitymodel.xml
>>>>
>>>>> In services.xml I define a service named createHelloPerson:
>>>>
>>>>> <service name="createHelloPerson" engine="java"
>>>>> location="org.ofbiz.hello3.Hello3Services"
>>>>> invoke="createHelloPerson">
>>>>> <description>Create a HelloPerson</description>
>>>>> <auto-attributes mode="IN" entity-name="HelloPerson"
>>>>> include="nonpk" optional="true" />
>>>>> <attribute name="helloPersonId" mode="OUT" type="String"
>>>>> optional="false" />
>>>>> </service>
>>>>
>>>>> All other files were well created.
>>>>
>>>>> Then I am starting OFBiz, A error encountered in console.log
>>>>
>>>>> 2009-02-05 18:02:59,540 (main) [UtilXml.java:243:DEBUG] XML Read
>>>>> 0.0s: D:/projects/ofbiz/hot-deploy/hello3/servicedef/services.xml
>>>>> 2009-02-05 18:02:59,555 (main) [   GenericDelegator.java:
>>>>> 304:ERROR]
>>>>> ---- exception report
>>>>> ----------------------------------------------------------
>>>>> Error getting entity definition from model
>>>>> Exception: org.ofbiz.entity.GenericModelException
>>>>> Message: Could not find definition for entity name
>>>>> hello3.HelloPerson
>>>>> ---- stack trace
>>>>> ---------------------------------------------------------------
>>>>> org.ofbiz.entity.GenericModelException: Could not find definition
>>>>> for
>>>>> entity name hello3.HelloPerson
>>>>> org
>>>>> .ofbiz.entity.model.ModelReader.getModelEntity(ModelReader.java:
>>>>> 456)
>>>>> org
>>>>> .ofbiz
>>>>> .entity.GenericDelegator.getModelEntity(GenericDelegator.java:3
>>>>> 02)
>>>>> org
>>>>> .ofbiz
>>>>> .service.ModelServiceReader.createAutoAttrDef(ModelServiceReade
>>>>> r.java:480)
>>>>> org
>>>>> .ofbiz
>>>>> .service.ModelServiceReader.createAutoAttrDefs(ModelServiceRead
>>>>> er.java:452)
>>>>> org
>>>>> .ofbiz
>>>>> .service.ModelServiceReader.createModelService(ModelServiceRead
>>>>> er.java:311)
>>>>> org
>>>>> .ofbiz
>>>>> .service.ModelServiceReader.getModelServices(ModelServiceReader
>>>>> .java:166)
>>>>> org
>>>>> .ofbiz.service.ModelServiceReader.<init>(ModelServiceReader.java:
>>>>> 100)
>>>>> org
>>>>> .ofbiz
>>>>> .service.ModelServiceReader.getModelServiceMap(ModelServiceRead
>>>>> er.java:81)
>>>>> org
>>>>> .ofbiz
>>>>> .service.DispatchContext.getGlobalServiceMap(DispatchContext.ja
>>>>> va:320)
>>>>> org
>>>>> .ofbiz.service.DispatchContext.loadReaders(DispatchContext.java:
>>>>> 79)
>>>>> org.ofbiz.service.GenericDispatcher.init(GenericDispatcher.java:
>>>>> 127)
>>>>> org.ofbiz.service.GenericDispatcher.<init>(GenericDispatcher.java:
>>>>> 115)
>>>>> org
>>>>> .ofbiz
>>>>> .service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
>>>>> .java:75)
>>>>> org
>>>>> .ofbiz
>>>>> .service.GenericDispatcher.getLocalDispatcher(GenericDispatcher
>>>>> .java:39)
>>>>> org
>>>>> .ofbiz
>>>>> .entityext.EntityServiceFactory.getLocalDispatcher(EntityServic
>>>>> eFactory.java:34)
>>>>> org
>>>>> .ofbiz
>>>>> .entityext.EntityServiceFactory.getDispatchContext(EntityServic
>>>>> eFactory.java:39)
>>>>> org
>>>>> .ofbiz
>>>>> .entityext.eca.DelegatorEcaHandler.setDelegator(DelegatorEcaHan
>>>>> dler.java:53)
>>>>> org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:
>>>>> 235)
>>>>> org
>>>>> .ofbiz
>>>>> .entity.GenericDelegator.getGenericDelegator(GenericDelegator.j
>>>>> ava:117)
>>>>> org
>>>>> .ofbiz
>>>>> .catalina.container.CatalinaContainer.init(CatalinaContainer.ja
>>>>> va:165)
>>>>> org
>>>>> .ofbiz
>>>>> .base.container.ContainerLoader.loadContainer(ContainerLoader.j
>>>>> ava:141)
>>>>> org
>>>>> .ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:
>>>>> 65)
>>>>> org.ofbiz.base.start.Start.initStartLoaders(Start.java:248)
>>>>> org.ofbiz.base.start.Start.init(Start.java:87)
>>>>> org.ofbiz.base.start.Start.main(Start.java:403)
>>>>
>>>>
>>>>> How to solve this problem or How OFBiz supports multi databases?
>>>>
>>>>> Thank you!
>>>>
>>>>
>>>>> Best Regards,
>>>>
>>>>> Jack Liu
>>>>
>>>>
>>> -----BEGIN PGP SIGNATURE-----
>>> Version: GnuPG v1.4.6 (MingW32)
>>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>>
>>> iD8DBQFJiyPGrP3NbaWWqE4RApviAJ474zo7abEYfYqoQsIBpJSdsNuh+ACgs8Cc
>>> G3l45u1OarvhOANyl0IbtwM=
>>> =3urv
>>> -----END PGP SIGNATURE-----
>>
>