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:david.jo...@hotwaxmedia.com]
Sent: 2009年2月6日 10:18
To: user@ofbiz.apache.org
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:bjf...@free-man.net]
Sent: 2009年2月6日 1:37
To: user@ofbiz.apache.org
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:bjf...@free-man.net]
Sent: 2009年2月5日 18:55
To: user@ofbiz.apache.org
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 via email to