Hi,
I'm a newby to ST and Seaside. I attempting to port web app that's written in Oracle/Java over to Seaside running on Pharo. The current application uses Oracle sequence generated unique id's for unique identifiers for records, is there a parallel to this when using just objects persisted in the Pharo image ? I know I can code my one implementation to replicate this but wondered whether this is the best way to model it, what are the alternatives and if it is the best way, is there a ready made package that I could use to generate unique id's ? TIA Jon _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
On Sun, Jan 17, 2010 at 4:51 PM, <[hidden email]> wrote: Hi, Wow! That's seems a very cool project :) Sorry I don't know the concrete answer to your question, however, I would like to give you two links that may be of help to you. Several times was discussion the "change of mind" that has to be done when moving from relational persistence to object persistence. Here are two good links that I recommend you to read completely: - http://lists.squeakfoundation.org/pipermail/seaside/2009-May/020688.html - http://gemstonesoup.wordpress.com/2009/05/19/gemstone-101-making-the-leap-from-rdbms-to-persistent-objects/ I wanted to let you know also that you can use SqueakDBX (http://www.squeakdbx.org/) to migrate your data from Oracle to Pharo objects. SqueakDBX is a generic database driver for Pharo and Squeak for different backends included Oracle. Finally, I would really think about persisting in image. For some applications this is reasonable, but maybe for bigger applications this seems like a limited approach to persist. If you want Object Oriented Databases, you can take a look to Magma or Gemstone/GLASS. Cheers Mariano TIA _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by recursive
El dom, 17-01-2010 a las 15:51 +0000, [hidden email] escribió:
> Hi, > > I'm a newby to ST and Seaside. I attempting to port web app that's > written in Oracle/Java over to Seaside running on Pharo. The current > application uses Oracle sequence generated unique id's for unique > identifiers for records, is there a parallel to this when using just > objects persisted in the Pharo image ? I know I can code my one > implementation to replicate this but wondered whether this is the best > way to model it, what are the alternatives and if it is the best way, > is there a ready made package that I could use to generate unique > id's ? Welcome, respect to your questions, in having a unique identifier is or medium difficult or completely unnecessary. Look, if you use the identifier to relate two rows in different tables (as a primary key in the first and a foreing key in the second) but only for that, then you don't need to code that in smalltalk, you only make one object reference (by storing the first object in a instance variable of the second object) between them. ClassA has instance variables "a" and accessors "a" and "a:" that read and write that instance variable. Same for ClassB. Now, if you want to make objects of ClassB "know" an object of ClassA then objectA = ClassA new. objectB = ClassB new. objectB b: objectA. "This in fact is making a reference from B to A" In this example, if you have an object of class B, and has stored an object A before, you can always reference that object A anytime. No need to have a number to reference it. If you need to know an index (maybe because is the invoice number and your reports must shown that number) then you can get this, by following the previous example, by storing everything in a OrderedCollection and then, when you need the number, you use the position of the item in the collection as your unique identifier. For this you can either convert the collection to an array (costly if you have several thousands of elements because you're essentially duplicating every item) and use the index of each element of the array or send the collection the keysAndValuesDo: message to get the item and their index in the collection, e.g. youCollection keysAndValuesDo: [ :index :value | "write your report" Transcript show: index; show: ' '; show: value; cr ]. Cheers > > TIA > Jon > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside -- Miguel Cobá http://miguel.leugim.com.mx _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by recursive
To me, "sequence #'s" usually implies numeric and consecutive, but you
only mentioned using them for unique identifiers. UUID (Universally Unique Identifier) can also be useful, if a little heavier than integral id's. Otherwise, Magma has has integral, consecutive sequence # generators. Often, however, "record identifiers" can be eliminated when moving to an object system, since objects have direct references to other objects. Regards, Chris On Sun, Jan 17, 2010 at 9:51 AM, <[hidden email]> wrote: > Hi, > > I'm a newby to ST and Seaside. I attempting to port web app that's written > in Oracle/Java over to Seaside running on Pharo. The current application > uses Oracle sequence generated unique id's for unique identifiers for > records, is there a parallel to this when using just objects persisted in > the Pharo image ? I know I can code my one implementation to replicate this > but wondered whether this is the best way to model it, what are the > alternatives and if it is the best way, is there a ready made package that I > could use to generate unique id's ? > > TIA > Jon > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by recursive
2010/1/17 <[hidden email]>:
> Hi, > > I'm a newby to ST and Seaside. I attempting to port web app that's written > in Oracle/Java over to Seaside running on Pharo. The current application > uses Oracle sequence generated unique id's for unique identifiers for > records, is there a parallel to this when using just objects persisted in > the Pharo image ? If we're just talking about objects stored in one image a simple counter protected by a Semphore/Mutex/Mutex2 might already do the trick. Could you explain what you need the ids for? Cheers Philippe _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by recursive
Hi,
Thanks for the replies and info. The unique id's are used to uniquely identify categories, items and events in the system. The categories, items and events are related so the unique id's are used as primary/foreign keys. The categories,items and events get added to quite frequently so using sequence generated id's seemed the best solution in that context.
A counter protected by a semaphore/mutex sounds like the sort of thing I was thinking of although I was unsure how well that scales.
Thanks
Jon
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
On Sun, Jan 17, 2010 at 5:39 PM, <[hidden email]> wrote:
> Hi, > > Thanks for the replies and info. The unique id's are used to uniquely > identify categories, items and events in the system. The categories, items > and events are related so the unique id's are used as primary/foreign > keys. The categories,items and events get added to quite frequently so > using sequence generated id's seemed the best solution in that context. > > A counter protected by a semaphore/mutex sounds like the sort of thing I was > thinking of although I was unsure how well that scales. > If you are using objects, you dont need the primary/foreign keys. The object is its own identifier. You just use the object graph. An event could have an ordered collection of categories it belongs to, etc. No need for unique ids. You would only need unique ids if the outside world needs a way to unique identify a specific instance of a class. Like... show me the information on event 27ABC3332 _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |