Hey,
I'm having a little bit of a problem here.
I have written a class Event whose objects I want to be mapped onto a database.
When I try to create a new glorp session I get the following exception and no database table is created:
Unhandled Exception: invalid attribute: --Event -->> #id in:
newSession
^ (Glorp.GlorpSession new
system: self descriptor;
accessor: self accessor)
Wait wait wait wait ... I got it.
I was about to continue this mail with the text under section ORIGINAL.
BUT, it was not my fault I dare say.
There is a class Smalltalk.UI.Event and apparently this seems to be a problem for GLORP.
Even though my Event is within an entirely different namespace.
Now I changed the name to Event2 and everything works fine ...
Is this supposed to be like this?
Regards,
Markus Kahl
_________
ORIGINAL
It does not have anything to do with the specific field, as the very same exception pops up
for any other field when I change the order in #descriptorForEvent.
Here is the code of my Glorp descriptor:
classModelForEvent: aClassModel
aClassModel newAttributeNamed: #id.
aClassModel newAttributeNamed: #fileId.
aClassModel newAttributeNamed: #slots.
aClassModel newAttributeNamed: #time.
descriptorForEvent: aDescriptor
| table |
table := self tableNamed: 'EVENTS'.
aDescriptor table: table.
(aDescriptor newMapping: DirectMapping) from: #id
to: (table fieldNamed: 'id').
(aDescriptor newMapping: DirectMapping) from: #fileId
to: (table fieldNamed: 'fileId').
(aDescriptor newMapping: DirectMapping) from: #time
to: (table fieldNamed: 'time').
(aDescriptor newMapping: DirectMapping) from: #slots
to: (table fieldNamed: 'slots').
tableForEVENTS: aTable
aTable createFieldNamed: 'fileId' type: (platform varChar: 17).
aTable createFieldNamed: 'time' type: platform time.
aTable createFieldNamed: 'slots' type: platform integer.
(aTable createFieldNamed: 'id' type: platform sequence) bePrimaryKey.
scheduleId := aTable createFieldNamed: 'scheduleId' type: platform int4.
aTable addForeignKeyFrom: scheduleId to: ((self tableNamed: 'SCHEDULES') fieldNamed: 'id').
constructAllClasses
^ (super constructAllClasses)
add: Event;
yourself.
When I remove the line "add: Event;" within #constructAllClasses the database table is created by the way.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc