Can't tell whats wrong either....

On Sep 24, 2010, at 5:45 PM, Theodore Petrosky wrote:

> ok. so I am still trying to get erattachment working. I have a little test 
> app.
> 
> I can select an image (pdf, jpg) and 'upload' it. When I click its link it 
> will show in the ERAttachmentViewer.
> 
> however if I quit and relaunch my app, the images do not reload from the 
> database (postgresql).
> 
> i see in the eclipse logs:
> 
> evaluateExpression: <com.webobjects.jdbcadaptor.PostgresqlExpression: "SELECT 
> t0.attachmentDataID, t0.available, t0.configurationName, t0.creationDate, 
> t0.filesystemPath, t0.height, t0.id, t0.mimeType, t0.originalFileName, 
> t0.ownerID, t0.parentID, t0.proxied, t0.s3Path, t0.size, t0.smallData, 
> t0.storageType, t0.thumbnail, t0.webPath, t0.width FROM ERAttachment t0 WHERE 
> ((t0.storageType = ?::varchar(10) OR t0.storageType = ?::varchar(10) OR 
> t0.storageType = ?::varchar(10)) AND t0.id = ?::int4) LIMIT 1" withBindings: 
> 1:"db"(storageType), 2:"file"(storageType), 3:"s3"(storageType), 4:1(id)>
> 
> Sep 24 12:28:12 AttachmentTest[54058] DEBUG NSLog  - fetch canceled
> Sep 24 12:28:12 AttachmentTest[54058] DEBUG NSLog  - 1 row(s) processed
> 
> 
> Why the fetch canceled, I don't know. Little things I see that shouldn't 
> matter, 'FROM ERAttachment'. of course postgresql will fold the name to 
> lowercase automatically and my table is named erattachment so this shouldn't 
> matter.
> 
> I see in the postgresql logs right after I click the hyperlink to view the 
> image:
> 
> [unknown]LOG:  execute <unnamed>: SELECT t0.data, t0.id FROM ERAttachmentData 
> t0 WHERE t0.id = $1::int4
> [unknown]DETAIL:  parameters: $1 = '1'
> 

Is there data on the table ERAttachmentData? Does the log show 1 row(s) 
processed?


> so it is trying to get the link. maybe I am saving bad data?
> 
> should I be massaging the data before trying to save it to the backend?
> 
> I do have in my properties file:
> 
> er.attachment.ImageMeta.image.storageType=db
> 
> 
> my migrations and connection dict look like:
> 
> # Migrations
> er.migration.migrateAtStartup=true
> er.migration.createTablesIfNecessary=true
> er.migration.modelNames=AttachmentTest
> AttachmentTest.MigrationClassPrefix=com.eltek.migrations.AttachmentTestMigration
> 
> # Connection Dictionary
> dbConnectURLGLOBAL=jdbc:postgresql://localhost/attachmenttest?capitalizeTypenames=true&zeroDateTimeBehavior=convertToNull
> dbConnectUserGLOBAL=asacksadmin
> dbConnectPasswordGLOBAL=4004
> dbConnectPluginGLOBAL=PostgresqlPlugIn
> dbConnectDriverGLOBAL=org.postgresql.Driver
> 
> 
> 
> 
> html
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
> <html>
>  <head>
>    <title>Untitled</title>
>  </head>
>  <body>
>    <webobject name = "TheForm">
>      <ul>
>        <wo:loop list = "$theMetaList" item = "$theMeta">
>          <li>
>            <wo:WOHyperlink action = "$selectMeta"><wo:WOString value = 
> "$theMeta.imageTitle" /></wo:WOHyperlink>
>          </li>
>        </wo:loop>
>      </ul>
>      <webobject name = "ImageUpload" />
>      <webobject name = "UploadAction" /><br/>
>      <webobjects name = "TheAttachmentViewer" />
>    </webobject>
>  </body>
> </html>
> 
> WOD
> 
> ImageUpload : ERAttachmentUpload {
>        configurationName = "ImageMeta.image";
>        editingContext = theEC;
>        attachment = theNewMeta.image;
> }
> 
> TheForm : WOForm {
>        enctype = "multipart/form-data";
>        multipleSubmit = true;
> }
> 
> 
> UploadAction : WOSubmitButton {
>        action = uploadImage;
>        value = "Upload Avatar!";
> }
> 
> TheAttachmentViewer : ERAttachmentViewer {
>       attachment = theSelectedMeta.image;
>       width = 150;
> }
> 
> 
> main.java
> 
> package com.eltek.components;
> 
> import com.eltek.models.ImageMeta;
> import com.eltek.models.People;
> import com.webobjects.appserver.WOContext;
> 
> import er.extensions.components.ERXComponent;
> import er.extensions.eof.ERXEC;
> 
> import com.webobjects.appserver.WOActionResults;
> import com.webobjects.eocontrol.EOEditingContext;
> import com.webobjects.foundation.NSArray;
> import com.webobjects.foundation.NSLog;
> 
> public class Main extends ERXComponent {
>       
>       public EOEditingContext theEC;
>       public NSArray<ImageMeta> theMetaList;
>       public ImageMeta theMeta, theNewMeta, _theSelectedMeta;
> 
> 
>       public People thePerson;
>       
>       public Main(WOContext context) {
>               super(context);
>               
>               theEC = ERXEC.newEditingContext();
>               thePerson = People.fetchPeople(theEC, null);
>               
>               theMetaList = ImageMeta.fetchImageMetas(theEC, null, null);
>               
>               theNewMeta = ImageMeta.createImageMeta(theEC, "the title", 
> thePerson); 
>               
>               NSLog.out.appendln("******** refreshing  theMetaList.count() " 
> + theMetaList.count()) ;
>               
>       }
> 
>       public WOActionResults uploadImage() {
>               theEC.saveChanges();
>               theMetaList = ImageMeta.fetchImageMetas(theEC, null, null);
>               theNewMeta = ImageMeta.createImageMeta(theEC, "the title", 
> thePerson); 
>               return null;
>       }
> 
>       public WOActionResults selectMeta() {
>               NSLog.out.appendln("******** refreshing  selectMeta() ") ;
> 
>               setTheSelectedMeta(theMeta);
>               return null;
>       }
>       
>       public ImageMeta theSelectedMeta() {
>               return _theSelectedMeta;
>       }
> 
>       public void setTheSelectedMeta(ImageMeta aMeta) {
>               this._theSelectedMeta = aMeta;
>       }
> }
> 
> 
> 
> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/lists%40farol.pt
> 
> This email sent to li...@farol.pt

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to