Hi there,
out there in Scarab we're facing a strange bug that is driving us crazy. We're currently using torque-3.1.1 and torque-gen-3.1.1-dev
You can take a look at the bug here (no user required):
http://www.solitone.org/scarab/issues/id/SCB1514
The problem, in a few words, is that "sometimes" (recipe still missing) the ID number returned by the IDBROKER is HUGEEEE. The value is not the primary key for a table (its the number part of the issue ID, you know scarab ;-) ).
I guess the code below (java, and id_table.xml) is the responsible: (full code here http://svn.collab.net/viewcvs/scarab/trunk/src /java/org/tigris/scarab/om/Issue.java?rev=9569&view=markup)
It's *old* code, and I don't really know why did it started failing, but I somehow don't dare to change it...
There are several things I don't understand in it:
* It seems to expect the first call to getIdAsInt failing, and then it
tries again synchronizing the call...
* If it fails again, it asumes it does not exist (!) and then starts the
count from 1 (this might be to make sure it finds a record in ID_TABLE
for a new module)
private int getNextIssueId(Connection con) throws Exception { int id = -1; String key = getIdTableKey(); DatabaseMap dbMap = IssuePeer.getTableMap().getDatabaseMap(); IDBroker idbroker = dbMap.getIDBroker(); try { id = idbroker.getIdAsInt(con, key); } catch (Exception e) { synchronized (idbroker) { try { id = idbroker.getIdAsInt(con, key); } catch (Exception idRetrievalErr) { // a module code entry in the id_table was likely not // entered, insert a row into the id_table and try again. try { saveIdTableKey(con); id = 1; } catch (Exception badException) { getLog().error("Could not get an id, even after " +"trying to add a module entry into the ID_TABLE", e); getLog() .error("Error trying to create ID_TABLE entry for " + getIdTableKey(), badException); // throw the original throw new ScarabException( L10NKeySet.ExceptionRetrievingIssueId, badException); } } } } return id; }
This is the definition of the ID_TABLE:
<database name="scarab"> <table name="ID_TABLE" idMethod="idbroker"> <column name="ID_TABLE_ID" required="true" primaryKey="true" type="INTEGER"/> <column name="TABLE_NAME" required="true" size="255" type="VARCHAR"/> <column name="NEXT_ID" type="INTEGER"/> <column name="QUANTITY" type="INTEGER"/>
<unique> <unique-column name="TABLE_NAME"/> </unique>
</table> </database>
Any hint about where the problem would be? Any idea about why is this code so *strange*?
Thanks!!
_ Jorge
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]