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

Reply via email to