Adrian Crum
a2c1465efd
Fixed a bug in the entity tests - JUnit expected and actual arguments were reversed in the testTransactionUtilRollback test.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1533542 13f79535-47bb-0310-9956-ffa450edef68
2013-10-18 16:34:09 +00:00
Adrian Crum
4b75f74431
Fixed some flaws in the JDBC password handling code. Improved JavaDocs in updated code.
...
The original code would provide a null or empty password (depending on code branching) if no password was configured, so I wasn't able to determine what the desired behavior was. Now an exception is thrown if there is no JDBC password, and datasource connection attempts fail gracefully.
If we want to support 'authenticationless' JDBC connections, then this will need to be looked at again.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1533202 13f79535-47bb-0310-9956-ffa450edef68
2013-10-17 18:33:49 +00:00
Adrian Crum
047036654c
Added some convenience methods to GenericHelperInfo.java that will help simplify client code.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1533171 13f79535-47bb-0310-9956-ffa450edef68
2013-10-17 17:27:51 +00:00
Adrian Crum
4dd795cb50
Code cleanup and small optimization in GenericHelperInfo.java.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1533147 13f79535-47bb-0310-9956-ffa450edef68
2013-10-17 16:42:42 +00:00
Jacques Le Roux
c8ce55ecc9
A patch from Anahita Goljahani for Fixed mispelling of "occurred" https://issues.apache.org/jira/browse/OFBIZ-5342
...
jleroux: this includes a safe change in jquery.validate.js and jquery.validate.min.js
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1530341 13f79535-47bb-0310-9956-ffa450edef68
2013-10-08 16:35:40 +00:00
Adrian Crum
91294728c2
Fixed a problem with bad try-catch-finally nesting and transaction handling in GenericDelegator.
...
1. The only exception caught was GenericEntityException, so any other thrown exception was missed - meaning the transaction was committed and GenericDelegator acted as if nothing was wrong.
2. The commit was performed in the finally block, so it was ALWAYS performed - even after an exception was thrown and the transaction was rolled back.
We managed to get away with this all along because typically there is a wrapping transaction that clears it all up. But still, the Delegator code needs to handle transactions correctly.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1527810 13f79535-47bb-0310-9956-ffa450edef68
2013-09-30 22:43:02 +00:00
Adrian Crum
d64e8c0c7c
Fixed a subtle flaw in the GenericDelegator.findOne method. When a database query returns no result, GenericValue.NULL_VALUE is put in the pk cache - so future findOne calls will know the entity value doesn't exist. But the findOne method never checked for GenericValue.NULL_VALUE in cache gets, so the database was queried again for an entity value we already know doesn't exist.
...
https://issues.apache.org/jira/browse/OFBIZ-5332
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1527626 13f79535-47bb-0310-9956-ffa450edef68
2013-09-30 16:13:03 +00:00
Adrian Crum
8117cb5756
Small change to GenericDelegator.findOne method - moved the primary key validation check to the beginning of the method.
...
I believe the original intention was to perform the validation check after the EV_VALIDATE ECAs were run, but the primary key was being used in three method calls before that happened - so those methods could have been passed an invalid primary key.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1527609 13f79535-47bb-0310-9956-ffa450edef68
2013-09-30 15:15:35 +00:00
Adrian Crum
d5511e39cd
Small code cleanup and optimization in ModelEntityChecker.java.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1526226 13f79535-47bb-0310-9956-ffa450edef68
2013-09-25 16:44:16 +00:00
Jacques Le Roux
ff5f0a5096
A patch for "Deprecate doCacheClear in Delegator interface and class and related minilang classes" https://issues.apache.org/jira/browse/OFBIZ-5325
...
* Deprecates methods in Delegator interface and class
* Deprecates cache clear related variable and methods in EntitySaxReader class
* Deprecates cache clear related variables in minilang related delegator classes
* In simple-method schema annotations, marks do-cache-clear attribute as deprecated
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1524704 13f79535-47bb-0310-9956-ffa450edef68
2013-09-19 12:03:47 +00:00
Adrian Crum
572ac66d16
Minor change to GenericDelegator - Put some logging calls inside if blocks.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1524183 13f79535-47bb-0310-9956-ffa450edef68
2013-09-17 19:17:49 +00:00
Adrian Crum
8004ad04c2
JavaDoc fix - no functional change.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1524134 13f79535-47bb-0310-9956-ffa450edef68
2013-09-17 17:17:56 +00:00
Jacques Le Roux
53343461e0
Since we decided to keep findAll, no reasons to deprecate
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1523645 13f79535-47bb-0310-9956-ffa450edef68
2013-09-16 13:38:08 +00:00
Jacques Le Roux
ca73e7694e
As suggested on dev ML, reintroduces findAll("EntityName") but uses the new pattern with a cache variable rather than a signature with "Cache" in method name (thanks to Adrian's comment on dev ML)
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1523507 13f79535-47bb-0310-9956-ffa450edef68
2013-09-15 21:58:38 +00:00
Jacques Le Roux
d54e2f098c
As suggested on dev ML, reintroduce findAll("EntityName"), I decided that findAllCache("EntityName") could be also. If you disagree on findAllCache, just remove it...
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1523466 13f79535-47bb-0310-9956-ffa450edef68
2013-09-15 17:53:43 +00:00
Jacopo Cappellato
3fd7d250d9
Fixed bug introduced in rev 1490678 (removal of cached DOM tree code and refactoring for thread-safety): after that commit it was not possible to define entity data readers at runtime, this fix re-enables the feature.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1516094 13f79535-47bb-0310-9956-ffa450edef68
2013-08-21 06:20:42 +00:00
Jacques Le Roux
1956e731a3
No functional changes, only formatting.
...
While looking for other cases like r1459222 and r1509164 introduced by r1300812 and r1305309. I noticed there were a lot of wrong for loops formatting (miss a white space after for), this changes it
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1511742 13f79535-47bb-0310-9956-ffa450edef68
2013-08-08 12:28:01 +00:00
Adam Heath
d950b6fb05
FEATURE: Allow constant numbers to be directly added to a query, instead
...
of having to deal with some kind of map/generic value. This makes it
simpler to use full-text-search queries thru the entity
engine(postgresql and oracle).
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1497893 13f79535-47bb-0310-9956-ffa450edef68
2013-06-28 19:08:39 +00:00
Adam Heath
8a497262d9
FIX: If using <extend-entity> to change the type of a pre-existing
...
field, then we need to be certain to remove the existing defined field
from the list of available fields. Otherwise, you'll end up with the
same field being queried in SELECT, and the same field being updated in
INSERT or UPDATE.
This issue was discovered when changing the type of a pre-existing
field(so that the length of the field could be increased).
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1497889 13f79535-47bb-0310-9956-ffa450edef68
2013-06-28 19:08:09 +00:00
Adrian Crum
c60b808b92
Reverting rev 1486552:
...
https://issues.apache.org/jira/browse/OFBIZ-5214
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1491170 13f79535-47bb-0310-9956-ffa450edef68
2013-06-09 10:04:15 +00:00
Adrian Crum
c1c2028fd4
Fixed a thread deadlock issue that seems to be specific to loading the MS SQL JDBC driver.
...
https://issues.apache.org/jira/browse/OFBIZ-5216
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1491165 13f79535-47bb-0310-9956-ffa450edef68
2013-06-09 09:24:49 +00:00
Adrian Crum
06ec6b5eaf
Removed some code I introduced in recent commits where I was hoping to support reloading the entityengine.xml file in a controlled manor, but it seems to be causing thread deadlocks.
...
https://issues.apache.org/jira/browse/OFBIZ-5216
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1490965 13f79535-47bb-0310-9956-ffa450edef68
2013-06-08 11:55:12 +00:00
Adrian Crum
91949082c1
Cleaned up the auto-generated code in the entity config models.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1490940 13f79535-47bb-0310-9956-ffa450edef68
2013-06-08 10:00:45 +00:00
Adrian Crum
18b5135a31
Third pass at removing cached DOM tree code from EntityConfigUtil.java. I converted some of the code to use the new thread-safe models.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1490938 13f79535-47bb-0310-9956-ffa450edef68
2013-06-08 09:34:47 +00:00
Adrian Crum
964a1d956d
Second pass at removing cached DOM tree code from EntityConfigUtil.java. I converted some of the code to use the new thread-safe models.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1490678 13f79535-47bb-0310-9956-ffa450edef68
2013-06-07 15:18:27 +00:00
Adrian Crum
7b84188235
First pass at removing cached DOM tree code from EntityConfigUtil.java. I converted some of the code to use the new thread-safe models. I also fixed some concurrency problems in related classes by replacing DCL with java.util.concurrent classes. I discovered the new multi-threaded component loader was creating duplicate resources, so these changes fix that.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1490541 13f79535-47bb-0310-9956-ffa450edef68
2013-06-07 08:39:44 +00:00
Adrian Crum
a2622d1d37
Improved entityengine.xml models:
...
1. Added file name and line number to validation code so exceptions can show where things went wrong.
2. Convert some attributes to primitive types.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1490535 13f79535-47bb-0310-9956-ffa450edef68
2013-06-07 08:21:22 +00:00
Adrian Crum
767deefce4
New models for the entityengine.xml file. These will be used to replace the DOM caching/parsing code in the same way as the service engine.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1490187 13f79535-47bb-0310-9956-ffa450edef68
2013-06-06 08:02:14 +00:00
Adrian Crum
f1a85663d1
Entity engine optimization: Use SELECT * when the fields to select have not been specified.
...
There was some code to check for this, but it was testing a "fields to select" List that was never empty, so SELECT * was never used.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1486552 13f79535-47bb-0310-9956-ffa450edef68
2013-05-27 09:49:02 +00:00
Adrian Crum
fa77ee6655
Fixed a bug in the entity engine pk cache where view entities went stale - https://issues.apache.org/jira/browse/OFBIZ-5192 .
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1484279 13f79535-47bb-0310-9956-ffa450edef68
2013-05-19 12:29:44 +00:00
Adam Heath
7b9961afcd
FEATURE: In NoTransaction.call, completely unwrap all nested exceptions, and re-wrap the innermost one. This is just like InTransaction.call.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1482509 13f79535-47bb-0310-9956-ffa450edef68
2013-05-14 18:09:38 +00:00
Adam Heath
a4b4054c77
FEATURE: Remove use of empty ArrayList/HashMap, instead using
...
Collections emptyList/emptyMap.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1482441 13f79535-47bb-0310-9956-ffa450edef68
2013-05-14 16:38:30 +00:00
Adam Heath
dbfb52c701
FORMATTING: Improve formatting; no single-line if, use {} for if.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1482440 13f79535-47bb-0310-9956-ffa450edef68
2013-05-14 16:38:23 +00:00
Adam Heath
8b9c0e537b
OPTIMIZE: Remove all SuppressWarnings("unchecked") from the entity
...
engine.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1482152 13f79535-47bb-0310-9956-ffa450edef68
2013-05-13 23:52:52 +00:00
Adam Heath
158bc8b1de
FEATURE: Allow for passwords in entityengine.xml to come from an
...
external passwords.properties file; nothing actually uses this yet,
however.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1482056 13f79535-47bb-0310-9956-ffa450edef68
2013-05-13 20:04:51 +00:00
Adam Heath
5f7e967d2c
OPTIMIZE: Move the fetching of the jdbc-password attribute into a single
...
global static method. Soon, this logic will be changed to support
looking the password up in an external file, so that security can be
imported.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1482055 13f79535-47bb-0310-9956-ffa450edef68
2013-05-13 20:04:43 +00:00
Adam Heath
7e7d53af0f
FEATURE: Add getFirst/getOnly variants that take a collection.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1482005 13f79535-47bb-0310-9956-ffa450edef68
2013-05-13 18:02:16 +00:00
Adam Heath
7beb84c605
FEATURE: getFirst/getOnly now use UtilValidate to verify non-emptiness.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1482004 13f79535-47bb-0310-9956-ffa450edef68
2013-05-13 18:02:08 +00:00
Adam Heath
4aaf4f720d
FEATURE: When there is no configured eca handler configured, only print
...
out the warning once, instead of on every single call. This actually
gives a rather impressive performance improvement.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1482002 13f79535-47bb-0310-9956-ffa450edef68
2013-05-13 18:01:54 +00:00
Adrian Crum
eb7dd6969a
Improvements to the ModelRelation and ModelKeyMap classes. Now the entity engine can accurately detect duplicate relations.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1481518 13f79535-47bb-0310-9956-ffa450edef68
2013-05-12 10:52:55 +00:00
Adrian Crum
df4f66cf6b
Reverted revision 1480891 and fixed the problem it tried to fix.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1481367 13f79535-47bb-0310-9956-ffa450edef68
2013-05-11 16:12:05 +00:00
Adrian Crum
06cc7b2e41
Remove Javolution from ModelViewEntity.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1478620 13f79535-47bb-0310-9956-ffa450edef68
2013-05-03 01:02:56 +00:00
Adrian Crum
cdccca8bd1
Made ModelInfo immutable, modified ModelEntity so it contains ModelInfo instead of extending it.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1478302 13f79535-47bb-0310-9956-ffa450edef68
2013-05-02 08:51:09 +00:00
Adrian Crum
2a5ccbb63b
Moving toward immutable entity model classes. Also some code cleanups, simplified API, and JavaDocs.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1477929 13f79535-47bb-0310-9956-ffa450edef68
2013-05-01 08:16:56 +00:00
Adrian Crum
6943eeb11d
A small overhaul for the ModelEntity class. The class is not thread-safe. Worse, there were four ModelField-related collections that were not updated consistently - causing invalid data. Two of the collections (field list and field map) were redundant, so I eliminated one.
...
This is a step toward thread-safety, but the class still isn't thread-safe. It would be best if this class was immutable, but that will require a lot of re-engineering.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1476826 13f79535-47bb-0310-9956-ffa450edef68
2013-04-28 20:10:02 +00:00
Adrian Crum
e68964ce58
Pull up some data and methods from GenericValue to GenericEntity. GenericValue is now a GenericEntity with some convenience methods.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1476745 13f79535-47bb-0310-9956-ffa450edef68
2013-04-28 09:47:32 +00:00
Adrian Crum
94669d6bbe
Some bug fixes for entity engine caches. GenericDelegator was inconsistent in clearing caches - some methods cleared the cache before the entity operation (wrong) while others cleared the cache after the entity operation (right). Also, I updated the Delegator JavaDocs to warn against skipping the cache clearing step - which shouldn't be done. Finally, the AbstractEntityConditionCache.storeHook method doesn't work (for a number of reasons) so I bypassed it.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1476296 13f79535-47bb-0310-9956-ffa450edef68
2013-04-26 17:04:49 +00:00
Adrian Crum
3e3b50c688
Removed the "embedded relation cache" from GenericValue because it is a bad idea and doesn't work. There was no code to keep the embedded cache current as the GenericValue's fields changed - so the cache contents are guaranteed to be invalid (stale).
...
If we want to improve the performance of relation lookups, then there are better ways to do it.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1471739 13f79535-47bb-0310-9956-ffa450edef68
2013-04-24 22:21:06 +00:00
Adrian Crum
4f1b5184e6
More work on GenericEntity and GenericValue immutability.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1471687 13f79535-47bb-0310-9956-ffa450edef68
2013-04-24 21:23:12 +00:00
Adrian Crum
2fce4a0c74
GenericEntity instances coming from EntityListCache are now immutable.
...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1471284 13f79535-47bb-0310-9956-ffa450edef68
2013-04-24 08:11:53 +00:00