Automatic DB Update

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

Automatic DB Update

bsanders1979
From what I've been reading, OFBiz is supposed to automatically update
your database if you modify an entity. For some reason, I cannot get
mine to update. I've tried using the Update Tool to no avail. Can anyone
tell me why I'm having issues? Thanks.

Reply | Threaded
Open this post in threaded view
|

Re: Automatic DB Update

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

It will add tables.
this is setup in the entityengine.xml
to do this.
 add-missing-on-start="true"

Sanders, Brian sent the following on 3/25/2009 6:30 AM:
>>From what I've been reading, OFBiz is supposed to automatically update
> your database if you modify an entity. For some reason, I cannot get
> mine to update. I've tried using the Update Tool to no avail. Can anyone
> tell me why I'm having issues? Thanks.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJyl4ArP3NbaWWqE4RAroHAJwNLHej5jMryN/aAeWtOv7xIoqjIACgldpn
L5AIItQnWKpInWz7HICKqFM=
=+TdK
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: Automatic DB Update

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

make sure you add the path to your entity file in the
ofbiz-component.xml of the component you put it in.
  <entity-resource type="model" reader-name="main" loader="main"
location="entitydef/yourentityfile.xml"/>


BJ Freeman sent the following on 3/25/2009 9:38 AM:

> It will add tables.
> this is setup in the entityengine.xml
> to do this.
>  add-missing-on-start="true"
>
> Sanders, Brian sent the following on 3/25/2009 6:30 AM:
>> >From what I've been reading, OFBiz is supposed to automatically update
>> your database if you modify an entity. For some reason, I cannot get
>> mine to update. I've tried using the Update Tool to no avail. Can anyone
>> tell me why I'm having issues? Thanks.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJyoENrP3NbaWWqE4RAkalAKC8vIAxtZiss6n7ZnRGSyS0AeBeWQCdFlOd
Bs5lL2QC9WmqPSxMZ00muAU=
=I9zV
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: Automatic DB Update

David E Jones-3
In reply to this post by bsanders1979

On Mar 25, 2009, at 7:30 AM, Sanders, Brian wrote:

> From what I've been reading, OFBiz is supposed to automatically update
> your database if you modify an entity. For some reason, I cannot get
> mine to update. I've tried using the Update Tool to no avail. Can  
> anyone
> tell me why I'm having issues? Thanks.

Here is an index of older documentation, that has unfortunately been  
mostly buried as people like to write new stuff more than maintain old  
stuff:

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

For this question the Entity Engine Configuration Guide has helpful  
info:

http://ofbiz.apache.org/docs/entityconfig.html

-David


Reply | Threaded
Open this post in threaded view
|

RE: Automatic DB Update

bsanders1979
In reply to this post by BJ Freeman
What I'm doing is adding a column/field to ReturnItem (although I think
I've changed my mind). I saw David's subsequent responses and will take
a look at those docs.

-----Original Message-----
From: BJ Freeman [mailto:[hidden email]]
Sent: Wednesday, March 25, 2009 3:08 PM
To: [hidden email]
Subject: Re: Automatic DB Update

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

make sure you add the path to your entity file in the
ofbiz-component.xml of the component you put it in.
  <entity-resource type="model" reader-name="main" loader="main"
location="entitydef/yourentityfile.xml"/>


BJ Freeman sent the following on 3/25/2009 9:38 AM:
> It will add tables.
> this is setup in the entityengine.xml
> to do this.
>  add-missing-on-start="true"
>
> Sanders, Brian sent the following on 3/25/2009 6:30 AM:
>> >From what I've been reading, OFBiz is supposed to automatically
update
>> your database if you modify an entity. For some reason, I cannot get
>> mine to update. I've tried using the Update Tool to no avail. Can
anyone
>> tell me why I'm having issues? Thanks.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJyoENrP3NbaWWqE4RAkalAKC8vIAxtZiss6n7ZnRGSyS0AeBeWQCdFlOd
Bs5lL2QC9WmqPSxMZ00muAU=
=I9zV
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

RE: Automatic DB Update

bsanders1979
If you look near the bottom of
http://www.opensourcestrategies.com/ofbiz/hello_world3.php, you will see
an excerpt from a log file which shows DatabaseUtil adding a field to a
database. I checked the code and it looks like it should be adding the
field. Any ideas why this might not be working? I'm using a MySql db if
that makes any difference. Thanks.

-----Original Message-----
From: Sanders, Brian [mailto:[hidden email]]
Sent: Thursday, March 26, 2009 9:18 AM
To: [hidden email]
Subject: RE: Automatic DB Update

What I'm doing is adding a column/field to ReturnItem (although I think
I've changed my mind). I saw David's subsequent responses and will take
a look at those docs.

-----Original Message-----
From: BJ Freeman [mailto:[hidden email]]
Sent: Wednesday, March 25, 2009 3:08 PM
To: [hidden email]
Subject: Re: Automatic DB Update

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

make sure you add the path to your entity file in the
ofbiz-component.xml of the component you put it in.
  <entity-resource type="model" reader-name="main" loader="main"
location="entitydef/yourentityfile.xml"/>


BJ Freeman sent the following on 3/25/2009 9:38 AM:
> It will add tables.
> this is setup in the entityengine.xml
> to do this.
>  add-missing-on-start="true"
>
> Sanders, Brian sent the following on 3/25/2009 6:30 AM:
>> >From what I've been reading, OFBiz is supposed to automatically
update
>> your database if you modify an entity. For some reason, I cannot get
>> mine to update. I've tried using the Update Tool to no avail. Can
anyone
>> tell me why I'm having issues? Thanks.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJyoENrP3NbaWWqE4RAkalAKC8vIAxtZiss6n7ZnRGSyS0AeBeWQCdFlOd
Bs5lL2QC9WmqPSxMZ00muAU=
=I9zV
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

RE: Automatic DB Update

bsanders1979
After a little investigation, it turns out that in the entityengine.xml
file, there is an attribute which belongs to <datasource>: schema-name.
When OFBiz checks the database on startup, it was prepending the schema
to the table names which was causing the matching to fail. By removing
the attribute, OFBiz was able to make the match and add the column
automatically. If you look at
org.ofbiz.entity.jdbc.DatabaseUtil.checkDB():line 193, you will see the
statement:
if (tableNames.contains(entity.getTableName(datasourceInfo))) {

entity.getTableName(datasourceInfo) was returning <schema>.<table>
whereas tableNames contained only the <table>. When the column is added,
common sense tells me to look the column in the same place I defined it
(before/after a certain column), but it adds it to the end. I'm not sure
how easy it would be, but placing the column after a particular column
would be a nice feature. Unfortunately, I don't have the time to look
into incorporating it ATM, but maybe someone else would be able to.

-----Original Message-----
From: Sanders, Brian [mailto:[hidden email]]
Sent: Friday, March 27, 2009 9:07 AM
To: [hidden email]
Subject: RE: Automatic DB Update

If you look near the bottom of
http://www.opensourcestrategies.com/ofbiz/hello_world3.php, you will see
an excerpt from a log file which shows DatabaseUtil adding a field to a
database. I checked the code and it looks like it should be adding the
field. Any ideas why this might not be working? I'm using a MySql db if
that makes any difference. Thanks.

-----Original Message-----
From: Sanders, Brian [mailto:[hidden email]]
Sent: Thursday, March 26, 2009 9:18 AM
To: [hidden email]
Subject: RE: Automatic DB Update

What I'm doing is adding a column/field to ReturnItem (although I think
I've changed my mind). I saw David's subsequent responses and will take
a look at those docs.

-----Original Message-----
From: BJ Freeman [mailto:[hidden email]]
Sent: Wednesday, March 25, 2009 3:08 PM
To: [hidden email]
Subject: Re: Automatic DB Update

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

make sure you add the path to your entity file in the
ofbiz-component.xml of the component you put it in.
  <entity-resource type="model" reader-name="main" loader="main"
location="entitydef/yourentityfile.xml"/>


BJ Freeman sent the following on 3/25/2009 9:38 AM:
> It will add tables.
> this is setup in the entityengine.xml
> to do this.
>  add-missing-on-start="true"
>
> Sanders, Brian sent the following on 3/25/2009 6:30 AM:
>> >From what I've been reading, OFBiz is supposed to automatically
update
>> your database if you modify an entity. For some reason, I cannot get
>> mine to update. I've tried using the Update Tool to no avail. Can
anyone
>> tell me why I'm having issues? Thanks.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJyoENrP3NbaWWqE4RAkalAKC8vIAxtZiss6n7ZnRGSyS0AeBeWQCdFlOd
Bs5lL2QC9WmqPSxMZ00muAU=
=I9zV
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: Automatic DB Update

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

actually if you have a entity and/or extend an entity this should not be
a problem.
Now if you have a DB already then of course setting the schema is important.
The way ofbiz works is the DB layers is a common feature layer.
so what every DB is supported that has the least feature is what this
layer does.
However if you wish to expand on this, feel free to contribute.


Sanders, Brian sent the following on 4/2/2009 12:54 PM:

> After a little investigation, it turns out that in the entityengine.xml
> file, there is an attribute which belongs to <datasource>: schema-name.
> When OFBiz checks the database on startup, it was prepending the schema
> to the table names which was causing the matching to fail. By removing
> the attribute, OFBiz was able to make the match and add the column
> automatically. If you look at
> org.ofbiz.entity.jdbc.DatabaseUtil.checkDB():line 193, you will see the
> statement:
> if (tableNames.contains(entity.getTableName(datasourceInfo))) {
>
> entity.getTableName(datasourceInfo) was returning <schema>.<table>
> whereas tableNames contained only the <table>. When the column is added,
> common sense tells me to look the column in the same place I defined it
> (before/after a certain column), but it adds it to the end. I'm not sure
> how easy it would be, but placing the column after a particular column
> would be a nice feature. Unfortunately, I don't have the time to look
> into incorporating it ATM, but maybe someone else would be able to.
>
> -----Original Message-----
> From: Sanders, Brian [mailto:[hidden email]]
> Sent: Friday, March 27, 2009 9:07 AM
> To: [hidden email]
> Subject: RE: Automatic DB Update
>
> If you look near the bottom of
> http://www.opensourcestrategies.com/ofbiz/hello_world3.php, you will see
> an excerpt from a log file which shows DatabaseUtil adding a field to a
> database. I checked the code and it looks like it should be adding the
> field. Any ideas why this might not be working? I'm using a MySql db if
> that makes any difference. Thanks.
>
> -----Original Message-----
> From: Sanders, Brian [mailto:[hidden email]]
> Sent: Thursday, March 26, 2009 9:18 AM
> To: [hidden email]
> Subject: RE: Automatic DB Update
>
> What I'm doing is adding a column/field to ReturnItem (although I think
> I've changed my mind). I saw David's subsequent responses and will take
> a look at those docs.
>
> -----Original Message-----
> From: BJ Freeman [mailto:[hidden email]]
> Sent: Wednesday, March 25, 2009 3:08 PM
> To: [hidden email]
> Subject: Re: Automatic DB Update
>
> make sure you add the path to your entity file in the
> ofbiz-component.xml of the component you put it in.
>   <entity-resource type="model" reader-name="main" loader="main"
> location="entitydef/yourentityfile.xml"/>
>
>
> BJ Freeman sent the following on 3/25/2009 9:38 AM:
>> It will add tables.
>> this is setup in the entityengine.xml
>> to do this.
>>  add-missing-on-start="true"
>
>> Sanders, Brian sent the following on 3/25/2009 6:30 AM:
>>> >From what I've been reading, OFBiz is supposed to automatically
> update
>>> your database if you modify an entity. For some reason, I cannot get
>>> mine to update. I've tried using the Update Tool to no avail. Can
> anyone
>>> tell me why I'm having issues? Thanks.
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJ1RrjrP3NbaWWqE4RAn9nAJsH95ocejJmvE3MRvPCKi9774kCtgCcCunT
dip4wBB16ZbDetsVRdRqnvc=
=xFki
-----END PGP SIGNATURE-----