Yes and no.

Not sure how EJB3 works so I cannot answer yes and no. I can tell you
what you can do.

1) you can define classes

    class MyObj:
       def say_three(self): return 3

2) you can make instances of the class persistent in various ways by
storing in cache

    myobj=cache.ram('myobj',lambda: MyObj(),timeout)

3) you can make instanced persistant for each session

    if not session.myobj: session.myobj=MyObj()

4) You can make in memory databases

    db=SQBD('sqlite:memory:')
    db.define_table('table_in_ram',SQLField('fieldname'))

and you can import/export the data.

    import cStringIO
    file=cStringIO.String()
    db.table_in_ram.export_to_csv_file(file)
    file.seek(0)
    db.table_in_ram.truncate()
    db.table_in_ram.import_form_csv_file(file)

Not sure how this compares with what you have in mind.

I do not expect and I would not want objects that are not stored in
database to expose the same API as if they were.

If you can give me a  more explicit example perhaps I can give a
better answer.


Massimo

On Feb 19, 2:50 pm, luckyboy <[email protected]> wrote:
> Does web2py support non-persistent model classes ? ie, a core model
> class where some business logic can be performed while that class
> doesn't necessarily (directly) map to a database table ?
> For example the model data can be retrieved from a remote web service,
> or a set of remote queries ?
> In all other MVC frameworks this is possible: In EJB3.0, unless you
> declare model as @entity it is not persistent. In RAILS, you can
> simply not inherit from ActiveRecord, and you may need to implement
> some methods like find, etc.. , or you can use a plugin like
> ActiveModel. Is this doable in web2py? My first guess is no.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to