Wiki source code of ERAttachment Framework

Last modified by David Holt on 2012/01/30 22:19

Hide last authors
Pascal Robert 43.1 1 == Tutorial Project and Screencast ==
David Holt 40.1 2
Pascal Robert 43.1 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>>url:http://wocommunity.org/documents/javadoc/wonder/latest/er/attachment/package-summary.html||shape="rect"]]
David Holt 40.1 4
Pascal Robert 43.1 5 [[http:~~/~~/wocommunity.org/podcasts/ERAttachment-Tutorial.mov>>url:http://wocommunity.org/podcasts/ERAttachment-Tutorial.mov||shape="rect"]]
David Holt 40.1 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
Pascal Robert 43.1 9 [[WONDER:ERAttachmentTutorial.zip>>attach:ERAttachmentTutorial.zip]]
David Holt 40.1 10
11 == Using ERAttachment with ERModernLook (ERD2W) ==
12
13 There are a few notes on using D2W components with ERAttachment on this page:
14
David Holt 45.1 15 [[doc:documentation.Home.Development Architecture.DirectToWeb Architecture.Direct To Web (D2W and ERD2W).ERModernLook.WebHome]]
David Holt 40.1 16
17 == **Oracle and ERAttachment Table Creation** ==
18
Johann Werner 14.1 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
David Holt 26.1 21 {{code}}
22
Johann Werner 14.1 23 er.extensions.ERXModelGroup.ERAttachment.size.columnName=attachmentSize
David Holt 26.1 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
Pascal Robert 42.1 37 {{note}}
38 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.
39 {{/note}}
40
Pascal Robert 43.1 41 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.
David Holt 26.1 42
43 Changing the migration-generated tables is easy, for example:
44
45 {{code}}
46
47 ALTER TABLE ERAttachmentData MODIFY data MEDIUMBLOB;
48
49 or
50
David Holt 40.1 51 ALTER TABLE ERAttachmentData MODIFY data LONGBLOB;
David Holt 26.1 52
53 {{/code}}