Wiki source code of ERAttachment Framework
Version 14.1 by Johann Werner on 2012/01/16 09:05
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | == Tutorial Project and Screencast == | ||
2 | |||
3 | I have created a small tutorial video to describe the simplest configurations of ERAttachment framework. Hopefully once you get your feet wet, the additional configurations possible won't be so daunting. See the [[Official ERAttachment Package Summary/Overview>>http://webobjects.mdimension.com/hudson/job/Wonder54/javadoc/er/attachment/package-summary.html]] | ||
4 | |||
5 | [[http:~~/~~/wocommunity.org/podcasts/ERAttachment-Tutorial.mov>>http://wocommunity.org/podcasts/ERAttachment-Tutorial.mov]] | ||
6 | |||
7 | The tutorial video refers to the following application that demonstrates how to use the ERAttachment Framework to store a Person entity's photo. | ||
8 | |||
9 | [[ERAttachmentTutorial.zip>>^ERAttachmentTutorial.zip]] | ||
10 | |||
11 | == Using ERAttachment with ERModernLook (ERD2W) == | ||
12 | |||
13 | There are a few notes on using D2W components with ERAttachment on this page: | ||
14 | |||
15 | [[WO:ERModernLook]] | ||
16 | |||
17 | == **Oracle and ERAttachment Table Creation** == | ||
18 | |||
19 | If you are using Oracle with ERAttachment, the table creation will fail because one of the attributes is called "size" and this is a reserved word in Oracle DB. To fix that problem, add this to your Properties : | ||
20 | |||
21 | {{code}} | ||
22 | |||
23 | er.extensions.ERXModelGroup.ERAttachment.size.columnName=attachmentSize | ||
24 | |||
25 | {{/code}} | ||
26 | |||
27 | If you want to use ERAttachment without using ERXApplication, you need to register the request handler in your Application class with : | ||
28 | |||
29 | {{code}} | ||
30 | |||
31 | ERAttachmentPrincipal.sharedInstance(ERAttachmentPrincipal.class).finishInitialization(); | ||
32 | |||
33 | {{/code}} | ||
34 | |||
35 | == MySQL and ERAttachmentData BLOB size == | ||
36 | |||
37 | {{note}} | ||
38 | |||
39 | This shouldn't be necessary anymore. If your data column will be created as BLOB instead of LONGBLOB you should check your connection settings. You should have set the used prototypes either globally with dbEOPrototypesEntityGLOBAL=EOJDBCMySQLPrototypes or just for your attachment model with ERAttachment.EOPrototypesEntity=EOJDBCMySQLPrototypes. | ||
40 | |||
41 | {{/note}} | ||
42 | |||
43 | The prototype for ERAttachmentData.data is 'blob', and the blob proto for MySQL is BLOB when it should really be LONGBLOB. In MySQL a BLOB is on 65K+, a MEDIUMBLOB is up to 64MB and a LONGBLOB is up to 4GB. FrontBase, for example, has only one type, BLOB for binary large objects and it is defined as 4GB (4^^32 bytes). So if you don't want to think about it, then use LONGBLOB in MySQL. If you want to limit the size of what someone can upload and 64MB is the biggest attachment you ever want to be accepted into the database, use MEDIUMBLOB.^^ | ||
44 | |||
45 | Changing the migration-generated tables is easy, for example: | ||
46 | |||
47 | {{code}} | ||
48 | |||
49 | ALTER TABLE ERAttachmentData MODIFY data MEDIUMBLOB; | ||
50 | |||
51 | or | ||
52 | |||
53 | ALTER TABLE ERAttachmentData MODIFY data LONGBLOB; | ||
54 | |||
55 | {{/code}} |