[Bug 656] New: Extended Prototypes objects do not return as correct type

View: New views
3 Messages — Rating Filter:   Alert me  

[Bug 656] New: Extended Prototypes objects do not return as correct type

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://helma.org/bugs/show_bug.cgi?id=656

           Summary: Extended Prototypes objects do not return as correct
                    type
           Product: Helma
           Version: 1.6.3
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: Database Layer
        AssignedTo: helma-dev@...
        ReportedBy: maksim.lin@...


Seems that Prototypes that extend from another prototype are broken at the
moment, as when you fetch an object back from a SQL db, you get back an object
of the "supertype" ie. the Prototype that it extended from, rather then the
"subtype".

Eg.

Person.properties:
_db = testDB
_table = PERSON
_id = ID
name = NAME

Author.properties:
_extends = Person
_prototype = TYPE

bookid = BOOK_ID

Root.properties:
authors = collection(Author)

test.hac:
var nuAuthor = new Author();
nuAuthor.name = "Mr Test";
root.authors.add(nuAuthor);

Now if you run the above test action AND THEN flush the Helma app and do:

res.debug(root.authors.get(0))

you will get a Person object back, and Not a Author object.

Looking in the sql database, I can see the PERSON.TYPE columns values are being
correctly set to the correct subtype ("Author") but somewhere in the java
database layer code, the object is being created with the wrong type when its
data is retrieved from the DB - though I have not yet been able to find the
spot in the db layer code that does this.


--
Configure bugmail: http://helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 656] Extended Prototypes objects do not return as correct type

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://helma.org/bugs/show_bug.cgi?id=656





------- Comment #1 from hannes@...  2009-02-17 10:26 -------
I think the problem is that you need to define the _prototype mapping in the
supertype. When Helma fetches data from the PERSON table, it knows that it is
mapped to the Person prototype or it subtypes, so it looks at the Person
mapping for _prototype mappings. Actually, I think you only have to define
_prototype in Person. Please let me know if this fixes the problem.


--
Configure bugmail: http://helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 656] Extended Prototypes objects do not return as correct type

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://helma.org/bugs/show_bug.cgi?id=656


maksim.lin@... changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Comment #2 from maksim.lin@...  2009-02-17 23:46 -------
Thanks very much for the quick reply Hannes.
You're 100% correct, that was the problem, as soon as I moved the _prototype
out of the subtype and into the parent type, it all works fine.
As a reminder to myself and others, I've also added a comment about this in the
Object-Relational Mapping Guide on helma.org


--
Configure bugmail: http://helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev