You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Dave Newton <ne...@pingsite.com> on 2005/08/11 02:53:35 UTC

ID Broker woes...

And by "woe" I mean "whoa!"

The bits of Model that are important:
Events have AnnouncementTypes
When a new Event is created its AnnouncementTypes are copied from from 
DefaultAnnouncementTypes

So I iterate over the DefaultAnnouncementTypes, use 
BeanUtils.copyProperties to get everything that's the same copied from 
the defaults into the Event's AnnouncementTypes. Not exactly rocket 
science, there are only a couple common fields (a label, an integer used 
as a boolean, a sequence number): the ID fields are named differently.

Today when I was saving the AnnouncementTypes the idbroker started 
re-using IDs and overwriting existing entries in the AnnouncementType table.

Torque 3.1, MySQL 4.1.8, WinXP SP2

The only thing I know for sure that I did was change the 
"usecleverquantity" to false. I tried changing it back and it didn't 
affect the behavior. It's a webapp which has been stopped and restarted 
several times during the debugging, so I don't think it's because it's 
keeping stuff around. I tweaked the ID_TABLE manually to see if I was 
having issues with Pretty High Numbers (which seems to happen on occasion?).

Chunks of schema:

  <table name='announcement_type' idMethod='idbroker'>
    <column name='announcement_price' size='255' type='VARCHAR' 
required='false'/>
    <column name='client_announcement' type='INTEGER'  required='false'/>
    <column name='event_id' type='INTEGER' required='true'/>
    <column name='sequence' type='INTEGER' required='true'/>
    <column name='announcement_type_label' size='255' type='VARCHAR' 
required='false'/>
    <column name='announcement_type_id' type='INTEGER' primaryKey='true' 
required='true'/>
    <foreign-key foreignTable='event'>
      <reference local='event_id' foreign='event_id'/>
    </foreign-key>
  </table>

  <table name='default_announcement_type' idMethod='idbroker' >
    <column name='client_announcement' type='INTEGER'  required='false'/>
    <column name='default_announcement_type_id' type='INTEGER'  
primaryKey='true' required='true'/>
    <column name='sequence' type='INTEGER'  required='true'/>
    <column name='announcement_type_label' size='255' type='VARCHAR'  
required='true'/>
  </table>

If there's anything else that would help let me know; I've never really 
had any issues with Torque so I don't know what all to provide :) It 
seemed to happen all at once, but I'm not sure I ever fully exercised 
this portion of the app, so it could have existed all along and I 
wouldn't have known (it was done under Really Stupid Timing Constraints :/

TIA,

Dave




---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: ID Broker woes...

Posted by Dave Newton <ne...@pingsite.com>.
Thomas Fischer wrote:

>If you copy the primary key, I would not be surprised if the primary key
>would be reused, so if the issue persists after you ruled out that please
>re-send a mail.
>  
>
Nope, that was definitely the problem... The hidden perils of 
reflection-based utilities and not paying attention to ALL the bean-like 
methods in the classes being copied :/

>the clean way would be to write a constructor
>AnnouncementType(DefaultAnnouncementType) and copy all the needed fields
>manually.
>  
>
Yep, did that.

Thanks,
Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: ID Broker woes...

Posted by Thomas Fischer <fi...@seitenbau.net>.



Hi,

If you copy the primary key, I would not be surprised if the primary key
would be reused, so if the issue persists after you ruled out that please
re-send a mail.

I presume the AnnouncementTypes and DefaultAnnouncementTypes are stored in
different tables. Then, it is difficult to tell Torque that the types are
nearly the same, so the clean way would be to write a constructor
AnnouncementType(DefaultAnnouncementType) and copy all the needed fields
manually.
If you would store the AnnouncementTypes and DefaultAnnouncementTypes in
one table using Torque's inherintance mechanism, you could use the
generated copy()  method to do the copying cleanly.

Just an idea,

      Thomas

Dave Newton <ne...@pingsite.com> schrieb am 11.08.2005 03:45:37:

> BAH!
>
> Dave Newton wrote:
>
> > So I iterate over the DefaultAnnouncementTypes, use
> > BeanUtils.copyProperties to get everything that's the same [...]
>
> This, however, includes such gems as "getPrimaryKey" and little things
> like that... which is bad.
>
> Never mind,
> Dave
>



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: ID Broker woes...

Posted by Dave Newton <ne...@pingsite.com>.
BAH!

Dave Newton wrote:

> So I iterate over the DefaultAnnouncementTypes, use 
> BeanUtils.copyProperties to get everything that's the same [...]

This, however, includes such gems as "getPrimaryKey" and little things 
like that... which is bad.

Never mind,
Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org