chainable key path Qualifier question.

2013-05-17 Thread James Cicenia
I am trying to get handy with ERXKey.

However, how does one go across relationships?

Say I want to find all order items for a store:

It doesn't know to traverse ORDER_ERXKEY to the STORE_ERXKEY

OrderItems.ORDER_ERXKEY.STORE_ERXKEY.eq(store);

How does one properly construct this query?

Thanks
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: chainable key path Qualifier question.

2013-05-17 Thread Jesse Tayler

have you seen the method called dot() ?

stuff like:

(Article.AUTHOR.dot(User.POSTER_ID))

dot rocks the box.



On May 17, 2013, at 11:50 AM, James Cicenia ja...@jimijon.com wrote:

 I am trying to get handy with ERXKey.
 
 However, how does one go across relationships?
 
 Say I want to find all order items for a store:
 
 It doesn't know to traverse ORDER_ERXKEY to the STORE_ERXKEY
 
 OrderItems.ORDER_ERXKEY.STORE_ERXKEY.eq(store);
 
 How does one properly construct this query?
 
 Thanks
 ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-dev/jtayler%40oeinc.com
 
 This email sent to jtay...@oeinc.com

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: chainable key path Qualifier question.

2013-05-17 Thread James Cicenia
Ah! Missed that key little method.
Thanks


On May 17, 2013, at 11:04 AM, Jesse Tayler jtay...@oeinc.com wrote:

 
 have you seen the method called dot() ?
 
 stuff like:
 
 (Article.AUTHOR.dot(User.POSTER_ID))
 
 dot rocks the box.
 
 
 
 On May 17, 2013, at 11:50 AM, James Cicenia ja...@jimijon.com wrote:
 
 I am trying to get handy with ERXKey.
 
 However, how does one go across relationships?
 
 Say I want to find all order items for a store:
 
 It doesn't know to traverse ORDER_ERXKEY to the STORE_ERXKEY
 
 OrderItems.ORDER_ERXKEY.STORE_ERXKEY.eq(store);
 
 How does one properly construct this query?
 
 Thanks
 ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-dev/jtayler%40oeinc.com
 
 This email sent to jtay...@oeinc.com
 

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Duplicate entry '4183884' for key 'PRIMARY'

2013-05-17 Thread Mark Gowdy
Hi, 

We have started getting more of these errors recently, now that the system is 
under more load.


EvaluateExpression failed: 
com.webobjects.jdbcadaptor._MySQLPlugIn$MySQLExpression: INSERT INTO 
queue_item(ITEM_DATE,  ...  etc)
Duplicate entry '4183884' for key 'PRIMARY'


I believe the problem is due to the fact that there is more than one instance 
trying to write to the 'queue_item' table, and the EO_PK_TABLE mechanism is 
handing out the same ID more than once.
Probably something to do with locking.

Our Database is MySQL 5, and the EO_PK_TABLE is of type MyISAM.

I tried to find the mechanism that allocate the primary key, but I keep bumping 
up against:

EOAdaptorChannel:
@Deprecated
public NSDictionaryString, Object 
primaryKeyForNewRowWithEntity(EOEntity entity){
return null;
}


Any advise would be appreciated, 

Thanks, 

Mark

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Duplicate entry '4183884' for key 'PRIMARY'

2013-05-17 Thread Mark Gowdy
Thanks Paul, it looks like you are correct.

Two 'Kieran Kelleher' email stated:

 There is also no row locking on EO_PK_TABLE with myisam, so you will get 
 primary key clashes and subsequent failed inserts if the db is sufficiently 
 contended.


and

 (1) Never use MyISAM - no transactional support means a failed 
 editingContext.saveChanges() will not result in a rollback and semi-saved 
 changes to the database. data integrity goes out the window. Use InnoDB 
  don't just convert live DB though, dump/import to a standby server, 
 configure InnoDB first completely and actually do a little bit of studying 
 the MySQL docs to understand how. Also, get a head start here: 
 https://github.com/kierankelleher/gic-mysql-tools
 
 (2) Don't create real foreign key constraints because MySQL does not 
 support deferred constraints (which is the biggest negative of using MySQL). 
 Instead just manually create indexes on every foreign key field. Otherwise 
 your performance will deteriorate as tables sizes get larger.

Seems like sound advise.
I now have some careful un-picking to do.

Also, incase anyone is interested, I eventually found the primary key 
generation code in JDBCPlugIn.class : newPrimaryKeys(int count, EOEntity 
entity, JDBCChannel channel)
Other DB plugins do their own thing, but the MySQL one appears to fall back on 
JDBCPlugIn.

Thanks again, 

Mark


On 17 May 2013, at 21:18, Paul Yu wrote:

 Well you certainly should not use MyIsam system.  Innodb is the right answer. 
  See Kieran's post on this subject.
 
 But I'm not sure that will be the end of your issues.
 
 Sent from my iPad
 
 On May 17, 2013, at 4:03 PM, Mark Gowdy go...@mac.com wrote:
 
 Hi, 
 
 We have started getting more of these errors recently, now that the system 
 is under more load.
 
 
 EvaluateExpression failed: 
 com.webobjects.jdbcadaptor._MySQLPlugIn$MySQLExpression: INSERT INTO 
 queue_item(ITEM_DATE,  ...  etc)
 Duplicate entry '4183884' for key 'PRIMARY'
 
 
 I believe the problem is due to the fact that there is more than one 
 instance trying to write to the 'queue_item' table, and the EO_PK_TABLE 
 mechanism is handing out the same ID more than once.
 Probably something to do with locking.
 
 Our Database is MySQL 5, and the EO_PK_TABLE is of type MyISAM.
 
 I tried to find the mechanism that allocate the primary key, but I keep 
 bumping up against:
 
 EOAdaptorChannel:
   @Deprecated
   public NSDictionaryString, Object primaryKeyForNewRowWithEntity(EOEntity 
 entity){
   return null;
   }
 
 
 Any advise would be appreciated, 
 
 Thanks, 
 
 Mark
 
 ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-dev/pyu%40mac.com
 
 This email sent to p...@mac.com

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Duplicate entry '4183884' for key 'PRIMARY'

2013-05-17 Thread Kieran Kelleher
InnoDB is all or nothing . don't waste your time mixing InnoDB and MyISAM 
in transactions - makes the results even more confusing.

Convert them all. evidently, InnoDB is faster nowadays anyway. innoDB can 
cache everything in memory. MyISAM IIRC only can cache PKs in memory and must 
always get rows from disk. There is no benefit to staying on MyISAM format.


On May 17, 2013, at 4:36 PM, Mark Gowdy go...@mac.com wrote:

 Thanks Paul, it looks like you are correct.
 
 Two 'Kieran Kelleher' email stated:
 
 There is also no row locking on EO_PK_TABLE with myisam, so you will get 
 primary key clashes and subsequent failed inserts if the db is sufficiently 
 contended.
 
 
 and
 
 (1) Never use MyISAM - no transactional support means a failed 
 editingContext.saveChanges() will not result in a rollback and semi-saved 
 changes to the database. data integrity goes out the window. Use InnoDB 
  don't just convert live DB though, dump/import to a standby server, 
 configure InnoDB first completely and actually do a little bit of studying 
 the MySQL docs to understand how. Also, get a head start here: 
 https://github.com/kierankelleher/gic-mysql-tools
 
 (2) Don't create real foreign key constraints because MySQL does not 
 support deferred constraints (which is the biggest negative of using MySQL). 
 Instead just manually create indexes on every foreign key field. Otherwise 
 your performance will deteriorate as tables sizes get larger.
 
 Seems like sound advise.
 I now have some careful un-picking to do.
 
 Also, incase anyone is interested, I eventually found the primary key 
 generation code in JDBCPlugIn.class : newPrimaryKeys(int count, EOEntity 
 entity, JDBCChannel channel)
 Other DB plugins do their own thing, but the MySQL one appears to fall back 
 on JDBCPlugIn.
 
 Thanks again, 
 
 Mark
 
 
 On 17 May 2013, at 21:18, Paul Yu wrote:
 
 Well you certainly should not use MyIsam system.  Innodb is the right 
 answer.  See Kieran's post on this subject.
 
 But I'm not sure that will be the end of your issues.
 
 Sent from my iPad
 
 On May 17, 2013, at 4:03 PM, Mark Gowdy go...@mac.com wrote:
 
 Hi, 
 
 We have started getting more of these errors recently, now that the system 
 is under more load.
 
 
 EvaluateExpression failed: 
 com.webobjects.jdbcadaptor._MySQLPlugIn$MySQLExpression: INSERT INTO 
 queue_item(ITEM_DATE,  ...  etc)
 Duplicate entry '4183884' for key 'PRIMARY'
 
 
 I believe the problem is due to the fact that there is more than one 
 instance trying to write to the 'queue_item' table, and the EO_PK_TABLE 
 mechanism is handing out the same ID more than once.
 Probably something to do with locking.
 
 Our Database is MySQL 5, and the EO_PK_TABLE is of type MyISAM.
 
 I tried to find the mechanism that allocate the primary key, but I keep 
 bumping up against:
 
 EOAdaptorChannel:
   @Deprecated
   public NSDictionaryString, Object 
 primaryKeyForNewRowWithEntity(EOEntity entity){
   return null;
   }
 
 
 Any advise would be appreciated, 
 
 Thanks, 
 
 Mark
 
 ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-dev/pyu%40mac.com
 
 This email sent to p...@mac.com
 
 ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-dev/kelleherk%40gmail.com
 
 This email sent to kelleh...@gmail.com

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com