You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by John Resler <jo...@gmail.com> on 2015/07/09 04:34:29 UTC

OFBiz and existing databases...

Hello,
    I am starting off with OFBiz and am integrating some preexisting
databases to applications migrated to OFBiz. The OFBiz entity engine is
proving difficult to work around for existing entities. I've read quite a
bit and understand the method behind the madness however I cannot change
the schemas of the existing databases. I do have OFBiz connecting to the
separate databases but obtaining connections within the Java code is
proving somewhat daunting.

I cringe that for the interim I have had to create direct JDBC connections
to the external databases. I would prefer to use the provided access but
cannot determine how to do this. It seems the objects related to performing
these connections are package private or have some other mechanism designed
to deter efforts in this direction. Nonetheless I need to do this.

I'm looking to perform what would be standard in an enterprise java
container such as get the context, lookup the JNDI environment for the
database connections and go from there. The entityengine.xml file seems to
indicate that JNDI settings can be used for datasource elements but it does
not then allow the connection information. It is either inline jdbc or a
JNDI reference to seemingly nowhere. I'd go on but you get the point.

I've searched high and low on Google and have not found answers to what I
need. Any help would be greatly appreciated

- JR

Re: OFBiz and existing databases...

Posted by Adrian Crum <ad...@sandglass-software.com>.
Yes, exactly.

The entity engine and service engine look for the id* field types, so 
you will need to keep those - just change the SQL types to match your 
external database.

Adrian Crum
Sandglass Software
www.sandglass-software.com

On 7/12/2015 7:43 AM, John Resler wrote:
> Thanks Adrian. If I understand you correctly then, copy the
> fieldtypemysql.xml and change the fields to mysql types? What about the
> field names? Does the entity engine in OFBiz not look for specific types
> like  id, id-long, and handle those according to the varchar(20) and
> varchar(60) types it would normally?
>
> On Sat, Jul 11, 2015 at 2:15 PM, Adrian Crum <
> adrian.crum@sandglass-software.com> wrote:
>
>> You can create a datasource-specific field type file. Then configure
>> entityengine.xml to use it.
>>
>> Adrian Crum
>> Sandglass Software
>> www.sandglass-software.com
>>
>>
>> On 7/11/2015 2:01 PM, John Resler wrote:
>>
>>> Thank you very much, Nicholas for the response. My last question would be,
>>> am I forced to use the mysql types defined in the fieldtypemysql.xml. If I
>>> have to change these then keeping the schema, with existing data is a bit
>>> of a lost cause.
>>>
>>> - John
>>>
>>> On Sat, Jul 11, 2015 at 1:46 PM, Nicolas Malin <ni...@nereide.fr>
>>> wrote:
>>>
>>>   Hello John
>>>>
>>>> When you define your database connection with data model not present on
>>>> OFBiz it's important to define a component with your an entitymodel that
>>>> corresponding.
>>>> 1. Define a new entitygroup : see example
>>>> framework/entity/entitydef/entitygroup.xml
>>>> 2. Associate each entity on this new group
>>>> 3. You can force on your entity the table and column name  (see
>>>> entity.table-name and field.col-name)
>>>> 4. Associate on the entityengine your new group to a new datasource (it's
>>>> important to understand all datasource.parameters) and the jdbc
>>>> connection
>>>> corresponding to your database
>>>>
>>>> Now all entity would be available from your delegator
>>>>
>>>> Nicolas
>>>>
>>>>
>>>>
>>>> Le 09/07/2015 04:34, John Resler a écrit :
>>>>
>>>>   Hello,
>>>>>        I am starting off with OFBiz and am integrating some preexisting
>>>>> databases to applications migrated to OFBiz. The OFBiz entity engine is
>>>>> proving difficult to work around for existing entities. I've read quite
>>>>> a
>>>>> bit and understand the method behind the madness however I cannot change
>>>>> the schemas of the existing databases. I do have OFBiz connecting to the
>>>>> separate databases but obtaining connections within the Java code is
>>>>> proving somewhat daunting.
>>>>>
>>>>> I cringe that for the interim I have had to create direct JDBC
>>>>> connections
>>>>> to the external databases. I would prefer to use the provided access but
>>>>> cannot determine how to do this. It seems the objects related to
>>>>> performing
>>>>> these connections are package private or have some other mechanism
>>>>> designed
>>>>> to deter efforts in this direction. Nonetheless I need to do this.
>>>>>
>>>>> I'm looking to perform what would be standard in an enterprise java
>>>>> container such as get the context, lookup the JNDI environment for the
>>>>> database connections and go from there. The entityengine.xml file seems
>>>>> to
>>>>> indicate that JNDI settings can be used for datasource elements but it
>>>>> does
>>>>> not then allow the connection information. It is either inline jdbc or a
>>>>> JNDI reference to seemingly nowhere. I'd go on but you get the point.
>>>>>
>>>>> I've searched high and low on Google and have not found answers to what
>>>>> I
>>>>> need. Any help would be greatly appreciated
>>>>>
>>>>> - JR
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>
>

Re: OFBiz and existing databases...

Posted by John Resler <jo...@gmail.com>.
Thanks Adrian. If I understand you correctly then, copy the
fieldtypemysql.xml and change the fields to mysql types? What about the
field names? Does the entity engine in OFBiz not look for specific types
like  id, id-long, and handle those according to the varchar(20) and
varchar(60) types it would normally?

On Sat, Jul 11, 2015 at 2:15 PM, Adrian Crum <
adrian.crum@sandglass-software.com> wrote:

> You can create a datasource-specific field type file. Then configure
> entityengine.xml to use it.
>
> Adrian Crum
> Sandglass Software
> www.sandglass-software.com
>
>
> On 7/11/2015 2:01 PM, John Resler wrote:
>
>> Thank you very much, Nicholas for the response. My last question would be,
>> am I forced to use the mysql types defined in the fieldtypemysql.xml. If I
>> have to change these then keeping the schema, with existing data is a bit
>> of a lost cause.
>>
>> - John
>>
>> On Sat, Jul 11, 2015 at 1:46 PM, Nicolas Malin <ni...@nereide.fr>
>> wrote:
>>
>>  Hello John
>>>
>>> When you define your database connection with data model not present on
>>> OFBiz it's important to define a component with your an entitymodel that
>>> corresponding.
>>> 1. Define a new entitygroup : see example
>>> framework/entity/entitydef/entitygroup.xml
>>> 2. Associate each entity on this new group
>>> 3. You can force on your entity the table and column name  (see
>>> entity.table-name and field.col-name)
>>> 4. Associate on the entityengine your new group to a new datasource (it's
>>> important to understand all datasource.parameters) and the jdbc
>>> connection
>>> corresponding to your database
>>>
>>> Now all entity would be available from your delegator
>>>
>>> Nicolas
>>>
>>>
>>>
>>> Le 09/07/2015 04:34, John Resler a écrit :
>>>
>>>  Hello,
>>>>       I am starting off with OFBiz and am integrating some preexisting
>>>> databases to applications migrated to OFBiz. The OFBiz entity engine is
>>>> proving difficult to work around for existing entities. I've read quite
>>>> a
>>>> bit and understand the method behind the madness however I cannot change
>>>> the schemas of the existing databases. I do have OFBiz connecting to the
>>>> separate databases but obtaining connections within the Java code is
>>>> proving somewhat daunting.
>>>>
>>>> I cringe that for the interim I have had to create direct JDBC
>>>> connections
>>>> to the external databases. I would prefer to use the provided access but
>>>> cannot determine how to do this. It seems the objects related to
>>>> performing
>>>> these connections are package private or have some other mechanism
>>>> designed
>>>> to deter efforts in this direction. Nonetheless I need to do this.
>>>>
>>>> I'm looking to perform what would be standard in an enterprise java
>>>> container such as get the context, lookup the JNDI environment for the
>>>> database connections and go from there. The entityengine.xml file seems
>>>> to
>>>> indicate that JNDI settings can be used for datasource elements but it
>>>> does
>>>> not then allow the connection information. It is either inline jdbc or a
>>>> JNDI reference to seemingly nowhere. I'd go on but you get the point.
>>>>
>>>> I've searched high and low on Google and have not found answers to what
>>>> I
>>>> need. Any help would be greatly appreciated
>>>>
>>>> - JR
>>>>
>>>>
>>>>
>>>
>>
>>


-- 
 "That was ungenerous! I'll take your guns for that!"
 - General Philip Sheridan after being fired upon by Confederacy troops for
toasting them in a somewhat insulting manner


John M. Resler
Captain USAF (Retired)
3255 South Dorsey Lane, #1069
Tempe, Arizona 85282

Re: OFBiz and existing databases...

Posted by Adrian Crum <ad...@sandglass-software.com>.
You can create a datasource-specific field type file. Then configure 
entityengine.xml to use it.

Adrian Crum
Sandglass Software
www.sandglass-software.com

On 7/11/2015 2:01 PM, John Resler wrote:
> Thank you very much, Nicholas for the response. My last question would be,
> am I forced to use the mysql types defined in the fieldtypemysql.xml. If I
> have to change these then keeping the schema, with existing data is a bit
> of a lost cause.
>
> - John
>
> On Sat, Jul 11, 2015 at 1:46 PM, Nicolas Malin <ni...@nereide.fr>
> wrote:
>
>> Hello John
>>
>> When you define your database connection with data model not present on
>> OFBiz it's important to define a component with your an entitymodel that
>> corresponding.
>> 1. Define a new entitygroup : see example
>> framework/entity/entitydef/entitygroup.xml
>> 2. Associate each entity on this new group
>> 3. You can force on your entity the table and column name  (see
>> entity.table-name and field.col-name)
>> 4. Associate on the entityengine your new group to a new datasource (it's
>> important to understand all datasource.parameters) and the jdbc connection
>> corresponding to your database
>>
>> Now all entity would be available from your delegator
>>
>> Nicolas
>>
>>
>>
>> Le 09/07/2015 04:34, John Resler a écrit :
>>
>>> Hello,
>>>       I am starting off with OFBiz and am integrating some preexisting
>>> databases to applications migrated to OFBiz. The OFBiz entity engine is
>>> proving difficult to work around for existing entities. I've read quite a
>>> bit and understand the method behind the madness however I cannot change
>>> the schemas of the existing databases. I do have OFBiz connecting to the
>>> separate databases but obtaining connections within the Java code is
>>> proving somewhat daunting.
>>>
>>> I cringe that for the interim I have had to create direct JDBC connections
>>> to the external databases. I would prefer to use the provided access but
>>> cannot determine how to do this. It seems the objects related to
>>> performing
>>> these connections are package private or have some other mechanism
>>> designed
>>> to deter efforts in this direction. Nonetheless I need to do this.
>>>
>>> I'm looking to perform what would be standard in an enterprise java
>>> container such as get the context, lookup the JNDI environment for the
>>> database connections and go from there. The entityengine.xml file seems to
>>> indicate that JNDI settings can be used for datasource elements but it
>>> does
>>> not then allow the connection information. It is either inline jdbc or a
>>> JNDI reference to seemingly nowhere. I'd go on but you get the point.
>>>
>>> I've searched high and low on Google and have not found answers to what I
>>> need. Any help would be greatly appreciated
>>>
>>> - JR
>>>
>>>
>>
>
>

Re: OFBiz and existing databases...

Posted by John Resler <jo...@gmail.com>.
Thank you very much, Nicholas for the response. My last question would be,
am I forced to use the mysql types defined in the fieldtypemysql.xml. If I
have to change these then keeping the schema, with existing data is a bit
of a lost cause.

- John

On Sat, Jul 11, 2015 at 1:46 PM, Nicolas Malin <ni...@nereide.fr>
wrote:

> Hello John
>
> When you define your database connection with data model not present on
> OFBiz it's important to define a component with your an entitymodel that
> corresponding.
> 1. Define a new entitygroup : see example
> framework/entity/entitydef/entitygroup.xml
> 2. Associate each entity on this new group
> 3. You can force on your entity the table and column name  (see
> entity.table-name and field.col-name)
> 4. Associate on the entityengine your new group to a new datasource (it's
> important to understand all datasource.parameters) and the jdbc connection
> corresponding to your database
>
> Now all entity would be available from your delegator
>
> Nicolas
>
>
>
> Le 09/07/2015 04:34, John Resler a écrit :
>
>> Hello,
>>      I am starting off with OFBiz and am integrating some preexisting
>> databases to applications migrated to OFBiz. The OFBiz entity engine is
>> proving difficult to work around for existing entities. I've read quite a
>> bit and understand the method behind the madness however I cannot change
>> the schemas of the existing databases. I do have OFBiz connecting to the
>> separate databases but obtaining connections within the Java code is
>> proving somewhat daunting.
>>
>> I cringe that for the interim I have had to create direct JDBC connections
>> to the external databases. I would prefer to use the provided access but
>> cannot determine how to do this. It seems the objects related to
>> performing
>> these connections are package private or have some other mechanism
>> designed
>> to deter efforts in this direction. Nonetheless I need to do this.
>>
>> I'm looking to perform what would be standard in an enterprise java
>> container such as get the context, lookup the JNDI environment for the
>> database connections and go from there. The entityengine.xml file seems to
>> indicate that JNDI settings can be used for datasource elements but it
>> does
>> not then allow the connection information. It is either inline jdbc or a
>> JNDI reference to seemingly nowhere. I'd go on but you get the point.
>>
>> I've searched high and low on Google and have not found answers to what I
>> need. Any help would be greatly appreciated
>>
>> - JR
>>
>>
>


-- 
 "That was ungenerous! I'll take your guns for that!"
 - General Philip Sheridan after being fired upon by Confederacy troops for
toasting them in a somewhat insulting manner


John M. Resler
Captain USAF (Retired)
3255 South Dorsey Lane, #1069
Tempe, Arizona 85282

Re: OFBiz and existing databases...

Posted by Nicolas Malin <ni...@nereide.fr>.
Hello John

When you define your database connection with data model not present on 
OFBiz it's important to define a component with your an entitymodel that 
corresponding.
1. Define a new entitygroup : see example 
framework/entity/entitydef/entitygroup.xml
2. Associate each entity on this new group
3. You can force on your entity the table and column name  (see 
entity.table-name and field.col-name)
4. Associate on the entityengine your new group to a new datasource 
(it's important to understand all datasource.parameters) and the jdbc 
connection corresponding to your database

Now all entity would be available from your delegator

Nicolas


Le 09/07/2015 04:34, John Resler a écrit :
> Hello,
>      I am starting off with OFBiz and am integrating some preexisting
> databases to applications migrated to OFBiz. The OFBiz entity engine is
> proving difficult to work around for existing entities. I've read quite a
> bit and understand the method behind the madness however I cannot change
> the schemas of the existing databases. I do have OFBiz connecting to the
> separate databases but obtaining connections within the Java code is
> proving somewhat daunting.
>
> I cringe that for the interim I have had to create direct JDBC connections
> to the external databases. I would prefer to use the provided access but
> cannot determine how to do this. It seems the objects related to performing
> these connections are package private or have some other mechanism designed
> to deter efforts in this direction. Nonetheless I need to do this.
>
> I'm looking to perform what would be standard in an enterprise java
> container such as get the context, lookup the JNDI environment for the
> database connections and go from there. The entityengine.xml file seems to
> indicate that JNDI settings can be used for datasource elements but it does
> not then allow the connection information. It is either inline jdbc or a
> JNDI reference to seemingly nowhere. I'd go on but you get the point.
>
> I've searched high and low on Google and have not found answers to what I
> need. Any help would be greatly appreciated
>
> - JR
>