There is a small bug in Entity Engine DatabaseUtil. When the metadata is
fetched from the database all column names are converted to capital letters (DatabaseUtil.java row 1047). But when the entities is checked if they have a corresponding table (and column) the column names are not converted to uppercase. Therefore row 206 should look like: fieldColNames.put(field.getColName().toUpperCase(), field); / Hans H |
Hans, Could you describe the actual problem you're having with this? Column names in OFBiz entity definitions are generated by default as upper case and manually defined ones should also be defined this way. -David On Sep 13, 2006, at 2:13 AM, Hans Holmlund wrote: > There is a small bug in Entity Engine DatabaseUtil. When the > metadata is fetched from the database all column names are > converted to capital letters (DatabaseUtil.java row 1047). But when > the entities is checked if they have a corresponding table (and > column) the column names are not converted to uppercase. Therefore > row 206 should look like: > fieldColNames.put(field.getColName > ().toUpperCase(), field); > > / Hans H |
The problem I had was that the DatabaseUtil thought some columns was not
created in the DB. Because the columns were in mixed case they were not found by row 217 in DatabaseUtil // -list all columns that do not have a corresponding field if (fieldColNames.containsKey(ccInfo.columnName)) { Then they were recreated in row 328 (// -list all fields that do not have a corresponding column) and onwards. This does not happen when you define an entity in an xml file, but I create them dynamically, like: ModelField field = new ModelField(); field.setName(fieldName); field.setColName(fieldName); field.setType(dbType); / Hans David E Jones skrev: > > Hans, > > Could you describe the actual problem you're having with this? > > Column names in OFBiz entity definitions are generated by default as > upper case and manually defined ones should also be defined this way. > > -David > > > On Sep 13, 2006, at 2:13 AM, Hans Holmlund wrote: > >> There is a small bug in Entity Engine DatabaseUtil. When the metadata >> is fetched from the database all column names are converted to >> capital letters (DatabaseUtil.java row 1047). But when the entities >> is checked if they have a corresponding table (and column) the column >> names are not converted to uppercase. Therefore row 206 should look >> like: >> >> fieldColNames.put(field.getColName().toUpperCase(), field); >> >> / Hans H > > |
In reply to this post by David E Jones-2
David,
is there any good reason why uppercase should be enforced on user defined tables? This can cause problems if for example you are trying to retrospectively tie the entity engine to a database table... - Andrew On Wed, 2006-09-13 at 04:59 -0600, David E Jones wrote: > Hans, > > Could you describe the actual problem you're having with this? > > Column names in OFBiz entity definitions are generated by default as > upper case and manually defined ones should also be defined this way. > > -David > > > On Sep 13, 2006, at 2:13 AM, Hans Holmlund wrote: > > > There is a small bug in Entity Engine DatabaseUtil. When the > > metadata is fetched from the database all column names are > > converted to capital letters (DatabaseUtil.java row 1047). But when > > the entities is checked if they have a corresponding table (and > > column) the column names are not converted to uppercase. Therefore > > row 206 should look like: > > fieldColNames.put(field.getColName > > ().toUpperCase(), field); > > > > / Hans H > Kind Regards Andrew Sykes <[hidden email]> Sykes Development Ltd http://www.sykesdevelopment.com |
This is an interesting issue, and a little tricky. Right now the Entity Engine only supports case insensitive database meta data. If we wanted to support both case sensitive and insensitive databases we'd need to have it be a configuration parameter (probably an attribute on the datasource element in the entityengine.xml file), and then treat each case differently in the code. I don't think it's possible (well, I can't think of a way...) to handle both case sensitive and insensitive databases with the same code without knowing which one we're dealing with. We also need to keep in mind that the intent of the Entity Engine is that entity definitions are not database specific, so we can't just look to see if the column name has mixed case characters or something. -David On Sep 13, 2006, at 10:30 AM, Andrew Sykes wrote: > David, > > is there any good reason why uppercase should be enforced on user > defined tables? > > This can cause problems if for example you are trying to > retrospectively > tie the entity engine to a database table... > > - Andrew > > On Wed, 2006-09-13 at 04:59 -0600, David E Jones wrote: >> Hans, >> >> Could you describe the actual problem you're having with this? >> >> Column names in OFBiz entity definitions are generated by default as >> upper case and manually defined ones should also be defined this way. >> >> -David >> >> >> On Sep 13, 2006, at 2:13 AM, Hans Holmlund wrote: >> >>> There is a small bug in Entity Engine DatabaseUtil. When the >>> metadata is fetched from the database all column names are >>> converted to capital letters (DatabaseUtil.java row 1047). But when >>> the entities is checked if they have a corresponding table (and >>> column) the column names are not converted to uppercase. Therefore >>> row 206 should look like: >>> fieldColNames.put(field.getColName >>> ().toUpperCase(), field); >>> >>> / Hans H >> > -- > Kind Regards > Andrew Sykes <[hidden email]> > Sykes Development Ltd > http://www.sykesdevelopment.com > |
Hello,
We need to create parties and on the creation process we need to first take certain fields, and search the database to make sure the contact or company doesn't already exist. The user should be presented with the list of potential matches, which can then be selected or the user can continue with new input. This automated search capability will be integrated into the creation process of various objects to avoid data duplication. For "Person" we need to check: SOUNDEX(First Name), SOUNDEX(Last Name), EXACT(Telecom Number), EXACT(Email) For "Company" we need to check: SOUNDEX(Company Name), EXACT(ZIP), EXACT(PHONE) Has anyone worked on anything similar to this? Any directions would be appreciated. Thanks in advance. Amit Shinde |
There is some similar stuff in the catalog manager for creating a product in a category (if I remember right) that searches for existing products based on certain information. There isn't anything special about this type of functionality so I don't think you'll find any secrets or re-usable code there... this sort of thing is just a couple of screens for user interaction and some queries to aid in that interaction... -David On Sep 14, 2006, at 12:27 AM, Amit Shinde wrote: > Hello, > We need to create parties and on the creation process we need to > first take > certain fields, and search the database to make sure the contact or > company > doesn't already exist. The user should be presented with the list of > potential matches, which can then be selected or the user can > continue with > new input. > > This automated search capability will be integrated into the creation > process of various objects to avoid data duplication. > > For "Person" we need to check: > SOUNDEX(First Name), SOUNDEX(Last Name), EXACT(Telecom Number), > EXACT(Email) > > For "Company" we need to check: > SOUNDEX(Company Name), EXACT(ZIP), EXACT(PHONE) > > Has anyone worked on anything similar to this? Any directions > would be > appreciated. > > Thanks in advance. > > > Amit Shinde > |
In reply to this post by Andrew Sykes
Hello.
Don't ask for details, it's just a faded memory (I'm not regularly working with databases), but I seem to remember that some databases always return column names in upper case when ased about table definitions. In case the entity engine relies on column names as returned by the database, it might be a good idea to always enforce all column and table names to be capitalized. br, -- Florin Jurcovici ------------------ Why do psychics have to ask you for your name? On Wed, 13 Sep 2006 19:30:32 +0300, Andrew Sykes <[hidden email]> wrote: > David, > > is there any good reason why uppercase should be enforced on user > defined tables? > > This can cause problems if for example you are trying to retrospectively > tie the entity engine to a database table... > > - Andrew > > On Wed, 2006-09-13 at 04:59 -0600, David E Jones wrote: >> Hans, >> >> Could you describe the actual problem you're having with this? >> >> Column names in OFBiz entity definitions are generated by default as >> upper case and manually defined ones should also be defined this way. >> >> -David >> >> >> On Sep 13, 2006, at 2:13 AM, Hans Holmlund wrote: >> >> > There is a small bug in Entity Engine DatabaseUtil. When the >> > metadata is fetched from the database all column names are >> > converted to capital letters (DatabaseUtil.java row 1047). But when >> > the entities is checked if they have a corresponding table (and >> > column) the column names are not converted to uppercase. Therefore >> > row 206 should look like: >> > fieldColNames.put(field.getColName >> > ().toUpperCase(), field); >> > >> > / Hans H >> |
Free forum by Nabble | Edit this page |