FAQ
Hi,

I have a new version (warning: alpha) of my opensource project gstpl
(Swing Timetable Platform, see gstpl.sf.net) which uses cayenne and derby.
Thank you for your project! I like it more than other mappers, because of
the easy 'reengineer-database' tool and of java class + db schema
generation! This is easier than hibernate. Okay expect some newbie
mistakes I made, see 'cayenne INSERTs NULL values instead of strings'
thread)
May be you want to 'learn' from gstpl (Things that I learned as a database
newbie in ONE month!!):
. How to create the database schema from the appliaction.
. Using grant/revoke in derby (new 10.2 beta allows that!
http://wiki.apache.org/db-derby/TenTwoRelease).
May be you have some comments on doing things better ...



Andrus, you want to switch from hsqldb to DERBY - I read this in a forum...
Here are my impressions:
. derby creates a bigger empty database (1.5MB) instead of some KB.
. derby is (only for gstpl) as fast as hsqldb.
. derby has a greater community (okay I know there are sun+ibm behind them
...)
. derby is more secure, offers database encryption and encrypted
authentication.
(. Derby does not allow a ';' in my sql statements?)
. derby passes the ACID test. For more infos:
http://weblogs.java.net/blog/davidvc/archive/2005/08/database_acidit.html
Andrus says:
. derby is saver if you need a good data integrity.



Now I have several questions related to CAYENNE:

If I create a new object, can I query the database (e.g. a SelectQuery)
without a commit? I tried this, but it does not work? Should'nt I get this
object from the cache instead of the db if it is new?

How to get the available column headers, not only the headers which I
defined in the modeler? (I wanted that users of gstpl can change the
columns of my tables from within gstpl.)
I tried SelectQuery select = new SelectQuery(tableName);
QueryMetadata meta = select.getMetaData(getContext().getEntityResolver());
Iterator iter = meta.getDbEntity().getAttributes().iterator();
colDefinition = new HashSet();
while(iter.hasNext())
colDefinition.add(((DbAttribute)iter.next()).getName());)

What could happen if I make a raw sql update statement? (Docs says: '...
and therefore may potentially leave object graph in an inconsistent
state.') What does this mean for me as programmer?

Does cayenne support user management in any sense?

Why or when should I use 'Remote Object Persistenc'? (Sorry for that
newbie question ...)

Which license-agreement-files should I add for gstpl? (it only uses the
cayenne.jar)

Last but not least: How do you earn money with cayenne?


Again: Thanks,
Peter.


___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de

Search Discussions

  • Andrus Adamchik at Sep 11, 2006 at 6:13 pm
    Hi Peter,

    Glad Cayenne worked out well for you and thanks for sharing Derby
    experience.
    On Sep 8, 2006, at 5:20 PM, Peter Karich wrote:
    If I create a new object, can I query the database (e.g. a
    SelectQuery) without a commit? I tried this, but it does not work?
    Should'nt I get this object from the cache instead of the db if it
    is new?
    No you can't, as all queries (except for ObjectIdQuery) are not
    matched against individual objects in the cache. Doing it otherwise
    would turn Cayenne into RDBMS itself :-) If this is really important,
    there are workarounds involving external transactions. If you really
    need that and ready to jump a few hoops, we can discuss the details.
    How to get the available column headers, not only the headers which
    I defined in the modeler? (I wanted that users of gstpl can change
    the columns of my tables from within gstpl.)
    I tried SelectQuery select = new SelectQuery(tableName);
    QueryMetadata meta = select.getMetaData(getContext
    ().getEntityResolver());
    Iterator iter = meta.getDbEntity().getAttributes().iterator();
    colDefinition = new HashSet();
    while(iter.hasNext()) colDefinition.add(((DbAttribute)iter.next
    ()).getName());)
    You are on the right track here. The only change - you need to map
    ALL table columns in the DbEntity, but only map a subset of them in
    the ObjEntity.

    What could happen if I make a raw sql update statement? (Docs says:
    '... and therefore may potentially leave object graph in an
    inconsistent state.') What does this mean for me as programmer?
    It means stale data. E.g.:

    // initial object state
    assertEquals("a", myArtist.getName());

    // run "update artist set name = 'b' where name = 'a'"

    // this will fail, as the artist name is still 'a' in memory
    assertEquals("b", myArtist.getName());

    What you can do is DataContext.invalidateObjects() if you can guess
    which artists are affected. Also 3.0 release introduces a
    RefreshQuery [1] that allows to invalidate groups of objects. Though
    3.0 is not yet released, and you'd have to build it yourself from SVN.
    Does cayenne support user management in any sense? No.
    Why or when should I use 'Remote Object Persistenc'? (Sorry for
    that newbie question ...)
    Most common scenario are desktop (Swing or SWT) apps that should not
    or can not access the DB directly.
    Which license-agreement-files should I add for gstpl? (it only uses
    the cayenne.jar)
    Each release contains a Cayenne license file (and licenses for all
    dependencies) that you need to include with the distribution of any
    Cayenne-based software. In 1.2 the licenses are located under
    "cayenne_install_dir/docs/licences/" directory. Since you do not
    distribute the modeler, you'll need "LICENSE" and "LICENSE.apache"
    files.
    Last but not least: How do you earn money with cayenne?
    If anybody knows the answer to this question, I'd like to know too :-)

    Seriously, most folks who are involved in development (myself
    included) are software consultants using Cayenne as a part of the
    stack when implementing solutions for their customers. Second common
    way (that is also a variety of consulting) is training and support
    for the framework.

    I guess a self-plug is due here - yes sometimes I do charge money to
    solve Cayenne problems :-)

    [1] http://cwiki.apache.org/confluence/display/CAY/RefreshQuery

    Andrus

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedSep 8, '06 at 9:15p
activeSep 11, '06 at 6:13p
posts2
users2
websitecayenne.apache.org

2 users in discussion

Andrus Adamchik: 1 post Peter Karich: 1 post

People

Translate

site design / logo © 2022 Grokbase