ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Crum <adrian.c...@yahoo.com>
Subject RE: Issues Creating Entities in Ofbiz from existing Schema
Date Sun, 31 Oct 2010 14:50:46 GMT
You would create entity definitions for your external tables (each table would be an entity).
Assign those entities to a unique group-name by including them in an entity-group.xml file.
Add the new group-name to the group-map element in entityengine.xml file and you are ready
to go. You can then access your external entities using the delegator.

-Adrian

--- On Sat, 10/30/10, Kapil garg <gargkapil@hotmail.com> wrote:
> Sure Adrian
> Appreciate your reply. 
> My question was while creating entity-group.xml file what
> is the entity name I need to give? Does it map to some table
> name. IF I do create this file with entity attribute then
> what do I need to put in entity-model.xml file for this
> entity?
> 
> 
> Kapil Garg
>  
> 
> 
> 
> 
> > Date: Sat, 30 Oct 2010 08:29:37 -0700
> > From: adrian.crum@yahoo.com
> > Subject: RE: Issues Creating Entities in Ofbiz from
> existing Schema
> > To: user@ofbiz.apache.org
> > 
> > You are asking a lot of questions, and they can all be
> answered, but it might be best to answer them one at a
> time.
> > 
> > I thought you were trying to connect OFBiz to an
> external database - and my instructions will do that. Once
> you have that working, we can move on to the other
> questions.
> > 
> > -Adrian
> > 
> > --- On Sat, 10/30/10, Kapil garg <gargkapil@hotmail.com>
> wrote:
> > 
> > > From: Kapil garg <gargkapil@hotmail.com>
> > > Subject: RE: Issues Creating Entities in Ofbiz
> from existing Schema
> > > To: user@ofbiz.apache.org
> > > Date: Saturday, October 30, 2010, 8:21 AM
> > > 
> > > how do we know which table or view does it map
> to? May it
> > > does not map to any of the tables and is just an
> entity by
> > > itself needed for ofbiz framework? If I were to
> put this
> > > entity entry then I would need to also create an
> > > entitymodel.xml file which would have some field
> tags? How
> > > do i now which ones are they? Are they mapping to
> one on one
> > > to a table in the schema? I would have imgined if
> that is
> > > the case then is there an ant target to create
> entity group
> > > or enity model xml files as it could be error
> prone given
> > > they conform to in built entity-model.xsd
> schemas
> > > 
> > > Aain how many such entitties do I need to create.
> If it is
> > > one per table then I have to create as many
> entites equal to
> > > the total numer off tables in the schemas. What
> about views
> > > oe indices etc How are they mapped? What about
> Stored
> > > Procedures, can they be converted to mmini lang
> or service
> > > classes?
> > > 
> > > 
> > > Kapil Garg
> > >  
> > > 
> > > 
> > > 
> > > 
> > > > Date: Sat, 30 Oct 2010 08:13:53 -0700
> > > > From: adrian.crum@yahoo.com
> > > > Subject: RE: Issues Creating Entities in
> Ofbiz from
> > > existing Schema
> > > > To: user@ofbiz.apache.org
> > > > 
> > > > Correct, you will need an entity-group.xml
> file. It
> > > should cntain one entry per external entity (or
> table).
> > > > 
> > > > -Adrian
> > > > 
> > > > --- On Sat, 10/30/10, Kapil garg <gargkapil@hotmail.com>
> > > wrote:
> > > > 
> > > > > From: Kapil garg <gargkapil@hotmail.com>
> > > > > Subject: RE: Issues Creating Entities
> in Ofbiz
> > > from existing Schema
> > > > > To: user@ofbiz.apache.org
> > > > > Date: Saturday, October 30, 2010, 8:11
> AM
> > > > > 
> > > > > but if it is in a default group then do
> I need to
> > > create an
> > > > > enity-group.xml file? Since all the
> groups within
> > > the
> > > > > default group do not have an
> entity-group.xml
> > > file I assumed
> > > > > creating a datasource within a default
> group does
> > > not
> > > > > require an entity-group.xml file. There
> isnt one
> > > for
> > > > > locaderby datasource which is a default
> one. But
> > > I could be
> > > > > wrong
> > > > > While creating the enitygroup file what
> name do I
> > > need to
> > > > > give to Entity atritbute of 
> entity-group?
> > > Random or
> > > > > schema name? Does each of this entity
> name map to
> > > a specific
> > > > > table or just the whole DB?
> > > > > <entitygroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > > >        
> > > > > xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitygroup.xsd">
> > > > > 
> > > > >   
> > > > > 
>    <entity-group
> > > group="org.ofbiz" entity="IS
> > > > > THIS A RANDOM NAME??"/>
> > > > > 
> > > > >  
> > > > > 
>    <entity-group
> > > group="org.ofbiz"
> > > > > entity="HOW MANY ENTITIES DO I NEED TO
> HAVE??ONE
> > > per
> > > > > Datasource or ONE Per Schema???"/>
> > > > > 
> > > > > </entitygroup>
> > > > > 
> > > > > Kapil Garg
> > > > >  
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > > Date: Sat, 30 Oct 2010 08:04:51
> -0700
> > > > > > From: adrian.crum@yahoo.com
> > > > > > Subject: Re: Issues Creating
> Entities in
> > > Ofbiz from
> > > > > existing Schema
> > > > > > To: user@ofbiz.apache.org
> > > > > > 
> > > > > > You need to give your external
> datasource a
> > > > > group-name. Then in your external
> entity
> > > definitions, assign
> > > > > the entities to that group.
> > > > > > 
> > > > > > -Adrian
> > > > > > 
> > > > > > --- On Fri, 10/29/10, Kapil garg
> <gargkapil@hotmail.com>
> > > > > wrote:
> > > > > > 
> > > > > > > From: Kapil garg <gargkapil@hotmail.com>
> > > > > > > Subject: Issues Creating
> Entities in
> > > Ofbiz from
> > > > > existing Schema
> > > > > > > To: user@ofbiz.apache.org
> > > > > > > Date: Friday, October 29,
> 2010, 12:09
> > > PM
> > > > > > > 
> > > > > > > I am trying to create a
> entities within
> > > OFbiz out
> > > > > of an
> > > > > > > existing schema in
> production. Not sure
> > > if this
> > > > > is the best
> > > > > > > way to create entties out of
> an
> > > existing schema.
> > > > > Suggestions
> > > > > > > are welcomed!!
> > > > > > > 
> > > > > > > I tried to add a datasource
> tag in
> > > default
> > > > > delegator in
> > > > > > > entity-engine.xml
> > > > > > > Followed the instructions on
> > > > > > > https://cwiki.apache.org/confluence/display/OFBIZ/Handling+of+External+data
> > > > > > > Would like to know where I am
> going
> > > wrong. On
> > > > > restart, I
> > > > > > > realised that ofbiz does not
> finish to
> > > the point
> > > > > that I can
> > > > > > > get webtools or even login
> for
> > > ecommerce. IT has
> > > > > just stuck
> > > > > > > at soem point saying 
> > > ServiceDispatcher.java
> > > > > 584 INFO
> > > > > > > Sync service..
> > > > > > > There is no exception or
> anything but
> > > OFbiz does
> > > > > not go
> > > > > > > further with complete
> laoding. Anything
> > > I am
> > > > > doing wrong?
> > > > > > > Being a default delegaotr,
> there was no
> > > special
> > > > > > > entity-group.xml file in the
> ofbiz 9_04
> > > code
> > > > > base. Hence I
> > > > > > > did not bother to create an
> > > entity-group.xml
> > > > > file
> > > > > > > My schema name is lronline,
> following
> > > are the
> > > > > entries I had
> > > > > > > in entity-engine.xml
> > > > > > >  <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="localderby"/>
> > > > > > >     
> > > > >    <group-map
> > > > > > > group-name="org.ofbiz.olap"
> > > > > > >
> datasource-name="localderbyolap"/>
> > > > > > >     
> > > > >    <group-map
> > > > > > > group-name="org.ofbiz"
> > > > > datasource-name="mysql"/>
> > > > > > > 
> > >    </delegator>
> > > > > > > 
> > > > > > > <datasource name="mysql"
> > > > > > >     
>    
> > >   
> > > > > > >
> > > > >
> > >
> 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="seed-initial"/>
> > > > > > >     
> > > > >    <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/lronlineonedb?autoReconnect=true"
> > > > > > >     
>    
> > >    
> > > > >   
> > > > > > > jdbc-username="root"
> > > > > > >     
>    
> > >    
> > > > >   
> > > > > > > jdbc-password=""
> > > > > > >     
>    
> > >    
> > > > >   
> > > > > > >
> isolation-level="ReadCommitted"
> > > > > > >     
>    
> > >    
> > > > >   
> > > > > > > pool-minsize="2"
> > > > > > >     
>    
> > >    
> > > > >   
> > > > > > > pool-maxsize="250"/>
> > > > > > >     
> > >    <!--
> > > > > <jndi-jdbc
> > > > > > > jndi-server-name="localjndi"
> > > > > > >
> jndi-name="java:/MySqlDataSource"
> > > > > > >
> isolation-level="Serializable"/>
> > > -->
> > > > > > > 
> > >    </datasource>
> > > > > > >     
> > > > > > > 
> > > > > > > 
> > > > > > > Kapil Garg
> > > > > > >  
> > > > > > > 
> > > > > > > 
> > > > > > >     
> > > > > > >     
>    
> > > > > > >   
>    
> > >    
> > > > > > >   
> > > > > > 
> > > > > > 
> > > > > >       
> > > > >     
> > > > >         
> > > > >       
>    
> > > > >   
> > > > 
> > > > 
> > > >       
> > >     
> > >         
> > >           
> > >   
> > 
> > 
> >       
>     
>         
>           
>   


      

Mime
View raw message