cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Baldwin <>
Subject Re: How to map/model files?
Date Sun, 22 Mar 2009 02:37:58 GMT

Again, I will preface my statements with the recommendation that you  
do a simple test to confirm your design.  One of the really cool  
aspects of Cayenne is that your workflow for a modification (or test  
in this case) is streamlined by CayenneModeler.

On Mar 21, 2009, at 6:41 PM, Joseph Schmidt wrote:

>> My preference (and it seems to be fairly efficient), is to continue  
>> with the standard design pattern of storing metadata (file-path,  
>> etc) in the database and storing the file in the filesystem.  You  
>> can them make programatic references much easier.
> Thank you. I used too mostly this is the approach with other  
> frameworks.
> I just wondered if Cayenne has some better support for this common  
> scenario.

I don't want to speak for the designers, but I suspect that their  
designs are in some respects limited to ORM patterns that can be  
abstracted across the leading databases.

As I mentioned, from my testing, Cayenne appears to perform  
competently wrt BLOB's (I think any limitations are DBMS-config like  
size limit and such).  The problem, is downstream of Cayenne. I  
Googled the issue and here is a JSP example
My analysis is that you can make it work, it is just going to result  
is way-ugly code (i.e. annoying maintenance-overhead for the life of  
your webapp).

>>> The second one seems to be the most efficient, but than the entire  
>>> transaction support is lost :(.
>> Not sure what you mean by "transaction support", so I can't comment  
>> on this.
> I mean that in the case of a file system based approach, where the  
> metadata is in the database, the operations on files are not guarded  
> by transactions, nor can they be process in the same Cayenne  
> transaction like on the metadata of those files. So when problems  
> occur during
> editing, deleting, etc. the system is not consistent and can't be  
> really rollbacked.

I see.  I believe that the maintenance advantage still out-weighs the  
rollback issue.  As a work-around, you could always implement a "Trash  
Can" - like design pattern and initiate a rollback if you do a Cayenne- 
rollback.  (Just a thought.)


View raw message