You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Richard Fleming <ri...@thebva.com> on 2007/05/24 20:07:20 UTC

Entity config problem

Hi all-
   
  I'm using the opentaps tutorial as an example....
   
  I need to have ofbiz create tables in a remote database server. I have the following definitions..webapp/hello3/entitydef/
   
  entitymodel.xml - I made no changes.
  entitygroup.xml - redefined the enities to...
   
  <entity-group group="org.ofbiz.lookup" entity="HelloPerson" />
  <entity-group group="org.ofbiz.lookup" entity="HelloHobby" />
  <entity-group group="org.ofbiz.lookup" entity="HelloPersonHobby" />
   
  entityengine.xml - created a new delegator..
   
  <delegator name="partslookup" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main">
  <group-map group-name="org.ofbiz.lookup" datasource-name="lookuppostgres"/> 
  </delegator>
   
  and created a new datasource..
   
  <datasource name="lookuppostgres"
  helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
  schema-name="public"
  field-type-name="postgres"
  check-on-start="true"
  add-missing-on-start="true"
  use-fk-initially-deferred="false"
  alias-view-columns="false"
  join-style="ansi"
  use-binary-type-for-blob="true">
  <!-- use this attribute to make the EntityListIterator more effective for pgjdbc 7.5devel and later:
  result-fetch-size="50"
  -->
  <read-data reader-name="seed"/>
  <read-data reader-name="demo"/>
  <read-data reader-name="ext"/>
  <inline-jdbc
  jdbc-driver="org.postgresql.Driver"
  jdbc-uri="jdbc:postgresql://192.168.0.28:5432/lookup"
  jdbc-username="postgres"
  jdbc-password=""
  isolation-level="ReadCommitted"
  pool-minsize="2"
  pool-maxsize="20"/>
  <!-- <jndi-jdbc jndi-server-name="default" jndi-name="java:comp/env/jdbc/localpostgres" isolation-level="ReadCommitted"/>-->
  <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/env/jdbc/xa/localpostgres" isolation-level="ReadCommitted"/> --> <!-- Orion Style JNDI name -->
  <!-- <jndi-jdbc jndi-server-name="localweblogic" jndi-name="PostgresDataSource"/> --> <!-- Weblogic Style JNDI name -->
  <!-- <jndi-jdbc jndi-server-name="default" jndi-name="jdbc/localpostgres" isolation-level="ReadCommitted"/> --> <!-- JRun4 Style JNDI name -->
  <!-- <tyrex-dataSource dataSource-name="localpostgres" isolation-level="ReadCommitted"/> -->
  </datasource>
   
  When I restart ofbiz, the tables are not created. What am I doing wrong? The connections in the datasource are valid since I can have ofbiz create the 700+ tables using the default delegator and this connection.
   
  Thanks 
  Rick

Re: Entity config problem

Posted by Chris Howe <cj...@yahoo.com>.
I believe the "default" delegator is initialized be cause it is called
in various web.xml files of components that load them.  Try placing
your new delagator name in a web.xml file in place of default.

--- Richard Fleming <ri...@thebva.com> wrote:

> Hi all-
>    
>   I'm using the opentaps tutorial as an example....
>    
>   I need to have ofbiz create tables in a remote database server. I
> have the following definitions..webapp/hello3/entitydef/
>    
>   entitymodel.xml - I made no changes.
>   entitygroup.xml - redefined the enities to...
>    
>   <entity-group group="org.ofbiz.lookup" entity="HelloPerson" />
>   <entity-group group="org.ofbiz.lookup" entity="HelloHobby" />
>   <entity-group group="org.ofbiz.lookup" entity="HelloPersonHobby" />
>    
>   entityengine.xml - created a new delegator..
>    
>   <delegator name="partslookup" entity-model-reader="main"
> entity-group-reader="main" entity-eca-reader="main">
>   <group-map group-name="org.ofbiz.lookup"
> datasource-name="lookuppostgres"/> 
>   </delegator>
>    
>   and created a new datasource..
>    
>   <datasource name="lookuppostgres"
>   helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
>   schema-name="public"
>   field-type-name="postgres"
>   check-on-start="true"
>   add-missing-on-start="true"
>   use-fk-initially-deferred="false"
>   alias-view-columns="false"
>   join-style="ansi"
>   use-binary-type-for-blob="true">
>   <!-- use this attribute to make the EntityListIterator more
> effective for pgjdbc 7.5devel and later:
>   result-fetch-size="50"
>   -->
>   <read-data reader-name="seed"/>
>   <read-data reader-name="demo"/>
>   <read-data reader-name="ext"/>
>   <inline-jdbc
>   jdbc-driver="org.postgresql.Driver"
>   jdbc-uri="jdbc:postgresql://192.168.0.28:5432/lookup"
>   jdbc-username="postgres"
>   jdbc-password=""
>   isolation-level="ReadCommitted"
>   pool-minsize="2"
>   pool-maxsize="20"/>
>   <!-- <jndi-jdbc jndi-server-name="default"
> jndi-name="java:comp/env/jdbc/localpostgres"
> isolation-level="ReadCommitted"/>-->
>   <!-- <jndi-jdbc jndi-server-name="default"
> jndi-name="comp/env/jdbc/xa/localpostgres"
> isolation-level="ReadCommitted"/> --> <!-- Orion Style JNDI name -->
>   <!-- <jndi-jdbc jndi-server-name="localweblogic"
> jndi-name="PostgresDataSource"/> --> <!-- Weblogic Style JNDI name
> -->
>   <!-- <jndi-jdbc jndi-server-name="default"
> jndi-name="jdbc/localpostgres" isolation-level="ReadCommitted"/> -->
> <!-- JRun4 Style JNDI name -->
>   <!-- <tyrex-dataSource dataSource-name="localpostgres"
> isolation-level="ReadCommitted"/> -->
>   </datasource>
>    
>   When I restart ofbiz, the tables are not created. What am I doing
> wrong? The connections in the datasource are valid since I can have
> ofbiz create the 700+ tables using the default delegator and this
> connection.
>    
>   Thanks 
>   Rick
> 


Re: Entity config problem

Posted by Richard Fleming <ri...@thebva.com>.
Thanks alot Chris - you've been very helpful!

Rick

Chris Howe <cj...@yahoo.com> wrote: I don't believe that the webtools entity maintenance
script(FindGeneric.bsh) is set up to handle the possiblility of
multiple delegators.

your error is on the method delegator.findCountByCondition (and other
delgator.someOtherMethods)
if you were to run:
del = delegator.getDelegatorName();
del would equal "default"

The script needs to somehow determine which delegator controls the
entity of interest. and then run delegator =
GenericDelegator.getGenericDelegator( nameOfCorrectDelegator);

then run the rest of the script

--- Richard Fleming  wrote:

> Chris,
>    
>   Thanks for the quick reply. You were right, I changed the web.xml
> file and the entity engine created the tables in the remote database.
> However, when I go to WebTools and click on the new tables, I get the
> following error:
>    
>   Target exception: org.ofbiz.entity.GenericEntityException: Helper
> name not found for entity HelloHobby
> (Sourced file:
>
component://webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh
> : Method Invocation delegator.findCountByCondition) (Error running
> BSH script at
>
[component://webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh],
> line [121]: Sourced file:
>
component://webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh
> : Method Invocation delegator.findCountByCondition : at Line: 121 :
> in file:
>
component://webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh
> : delegator .findCountByCondition ( findByEntity .getEntityName ( ) ,
> condition , null ) 
>    
>   The generic helper is defined in the datasource. what other change
> is needed?
>    
>   Thanks
>   Rick 
>   
> 
> Richard Fleming  wrote:
>   Hi all-
> 
> I'm using the opentaps tutorial as an example....
> 
> I need to have ofbiz create tables in a remote database server. I
> have the following definitions..webapp/hello3/entitydef/
> 
> entitymodel.xml - I made no changes.
> entitygroup.xml - redefined the enities to...
> 
> 
> 
> 
> 
> entityengine.xml - created a new delegator..
> 
> 
> 
> 
> 
> and created a new datasource..
> 
> helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
> schema-name="public"
> field-type-name="postgres"
> check-on-start="true"
> add-missing-on-start="true"
> use-fk-initially-deferred="false"
> alias-view-columns="false"
> join-style="ansi"
> use-binary-type-for-blob="true">
>   result-fetch-size="50"
>   -->
> 
> 
> 
> jdbc-driver="org.postgresql.Driver"
> jdbc-uri="jdbc:postgresql://192.168.0.28:5432/lookup"
> jdbc-username="postgres"
> jdbc-password=""
> isolation-level="ReadCommitted"
> pool-minsize="2"
> pool-maxsize="20"/>
> -->
>  -->
>  -->
>  -->
>  -->
> 
> 
> When I restart ofbiz, the tables are not created. What am I doing
> wrong? The connections in the datasource are valid since I can have
> ofbiz create the 700+ tables using the default delegator and this
> connection.
> 
> Thanks 
> Rick
> 
> 



Re: Entity config problem

Posted by Chris Howe <cj...@yahoo.com>.
I don't believe that the webtools entity maintenance
script(FindGeneric.bsh) is set up to handle the possiblility of
multiple delegators.

your error is on the method delegator.findCountByCondition (and other
delgator.someOtherMethods)
if you were to run:
del = delegator.getDelegatorName();
del would equal "default"

The script needs to somehow determine which delegator controls the
entity of interest. and then run delegator =
GenericDelegator.getGenericDelegator( nameOfCorrectDelegator);

then run the rest of the script

--- Richard Fleming <ri...@thebva.com> wrote:

> Chris,
>    
>   Thanks for the quick reply. You were right, I changed the web.xml
> file and the entity engine created the tables in the remote database.
> However, when I go to WebTools and click on the new tables, I get the
> following error:
>    
>   Target exception: org.ofbiz.entity.GenericEntityException: Helper
> name not found for entity HelloHobby
> (Sourced file:
>
component://webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh
> : Method Invocation delegator.findCountByCondition) (Error running
> BSH script at
>
[component://webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh],
> line [121]: Sourced file:
>
component://webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh
> : Method Invocation delegator.findCountByCondition : at Line: 121 :
> in file:
>
component://webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh
> : delegator .findCountByCondition ( findByEntity .getEntityName ( ) ,
> condition , null ) 
>    
>   The generic helper is defined in the datasource. what other change
> is needed?
>    
>   Thanks
>   Rick 
>   
> 
> Richard Fleming <ri...@thebva.com> wrote:
>   Hi all-
> 
> I'm using the opentaps tutorial as an example....
> 
> I need to have ofbiz create tables in a remote database server. I
> have the following definitions..webapp/hello3/entitydef/
> 
> entitymodel.xml - I made no changes.
> entitygroup.xml - redefined the enities to...
> 
> 
> 
> 
> 
> entityengine.xml - created a new delegator..
> 
> 
> 
> 
> 
> and created a new datasource..
> 
> helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
> schema-name="public"
> field-type-name="postgres"
> check-on-start="true"
> add-missing-on-start="true"
> use-fk-initially-deferred="false"
> alias-view-columns="false"
> join-style="ansi"
> use-binary-type-for-blob="true">
>   result-fetch-size="50"
>   -->
> 
> 
> 
> jdbc-driver="org.postgresql.Driver"
> jdbc-uri="jdbc:postgresql://192.168.0.28:5432/lookup"
> jdbc-username="postgres"
> jdbc-password=""
> isolation-level="ReadCommitted"
> pool-minsize="2"
> pool-maxsize="20"/>
> -->
>  -->
>  -->
>  -->
>  -->
> 
> 
> When I restart ofbiz, the tables are not created. What am I doing
> wrong? The connections in the datasource are valid since I can have
> ofbiz create the 700+ tables using the default delegator and this
> connection.
> 
> Thanks 
> Rick
> 
> 


Re: Entity config problem

Posted by Richard Fleming <ri...@thebva.com>.
Chris,
   
  Thanks for the quick reply. You were right, I changed the web.xml file and the entity engine created the tables in the remote database. However, when I go to WebTools and click on the new tables, I get the following error:
   
  Target exception: org.ofbiz.entity.GenericEntityException: Helper name not found for entity HelloHobby
(Sourced file: component://webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh : Method Invocation delegator.findCountByCondition) (Error running BSH script at [component://webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh], line [121]: Sourced file: component://webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh : Method Invocation delegator.findCountByCondition : at Line: 121 : in file: component://webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh : delegator .findCountByCondition ( findByEntity .getEntityName ( ) , condition , null ) 
   
  The generic helper is defined in the datasource. what other change is needed?
   
  Thanks
  Rick 
  

Richard Fleming <ri...@thebva.com> wrote:
  Hi all-

I'm using the opentaps tutorial as an example....

I need to have ofbiz create tables in a remote database server. I have the following definitions..webapp/hello3/entitydef/

entitymodel.xml - I made no changes.
entitygroup.xml - redefined the enities to...





entityengine.xml - created a new delegator..





and created a new datasource..

helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
schema-name="public"
field-type-name="postgres"
check-on-start="true"
add-missing-on-start="true"
use-fk-initially-deferred="false"
alias-view-columns="false"
join-style="ansi"
use-binary-type-for-blob="true">
  result-fetch-size="50"
  -->



jdbc-driver="org.postgresql.Driver"
jdbc-uri="jdbc:postgresql://192.168.0.28:5432/lookup"
jdbc-username="postgres"
jdbc-password=""
isolation-level="ReadCommitted"
pool-minsize="2"
pool-maxsize="20"/>
-->
 -->
 -->
 -->
 -->


When I restart ofbiz, the tables are not created. What am I doing wrong? The connections in the datasource are valid since I can have ofbiz create the 700+ tables using the default delegator and this connection.

Thanks 
Rick