[google-appengine] One-to-many relation problem

2012-03-30 Thread Bat
Hi All,

I'm trying to use the one-to-many relation with heritance but without
success. Let me explain.

I have 3 classes :

@PersistenceCapable
@Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
public abstract class Op {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
public Key key;

@Persistent(mappedBy = op)
@Element(dependent = true)
private ArrayListEntry entryArr = new ArrayListEntry();
}

 @PersistenceCapable
public class ExtendedOp extends Op {
public double quota;
}

@PersistenceCapable
public class Entry {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
public Key key;

@Persistent
private Op op = null;
}

When I persist, I use this code :
ExtendedOp op = new ExtendedOp();
op.addNewEntry(new Entry());
op.addNewEntry(new Entry());
pm.makePersistent(op);

After, I persisted, I reload the ExtendedOp with this :
String connectionQuery = select from  + ExtendedOp.class.getName();
 opArr = (ListExtendedOp) pm.newQuery(connectionQuery).execute();
 if (opArr != null) {
for (ExtendedOp opExt : opArr) {
if ( opExt.getEntryArr() != null)
for (Entry entry : sale.getEntryArr()) {
System.out.println(ok); //works!
if (entry.getOp() != null)
System.out.println(perfect); //never
display
}
}
}

The problem is : the Entry has the field operation always null. This
field is from the relation one-to-many. Maybe this field is still null
because is class type is parent of ExtendedOp?

Could you help me to solve that problem?

Thanks you very much,

Bat

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] One-to-many relation problem

2012-03-30 Thread Bat
 

Hi All,


I'm trying to use the one-to-many relation with heritance but without

success. Let me explain.


I have 3 classes :


@PersistenceCapable

@Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)

   public abstract class Op {

   @PrimaryKey

   @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)

   public Key key;


   @Persistent(mappedBy = op)

   @Element(dependent = true)

   private ArrayListEntry entryArr = new ArrayListEntry();

}


@PersistenceCapable

public class ExtendedOp extends Op {

   public double quota;

}


@PersistenceCapable

public class Entry {

@PrimaryKey

@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)

public Key key;


@Persistent

   private Op op = null;

}


When I persist, I use this code :

ExtendedOp op = new ExtendedOp();

op.addNewEntry(new Entry());

op.addNewEntry(new Entry());

pm.makePersistent(op);


After, I persisted, I reload the ExtendedOp with this :

String connectionQuery = select from  + ExtendedOp.class.getName();

opArr = (ListExtendedOp) pm.newQuery(connectionQuery).execute();

if (opArr != null) {

   for (ExtendedOp opExt : opArr) {

   if ( opExt.getEntryArr() != null)

   for (Entry entry : sale.getEntryArr()) {

   System.out.println(ok); //works!

   if (entry.getOp() != null)

   System.out.println(perfect); //never

display

   }

   }

   }


The problem is : the Entry has the field operation always null. This

field is from the relation one-to-many. Maybe this field is still null

because is class type is parent of ExtendedOp?


Could you help me to solve that problem?


Thanks you very much,


Bat

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/i_qtiXxQ4cYJ.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[appengine-java] Re: Failed to initialize App Engine SDK at ... appengine-java-sdk-1.6.0

2012-01-05 Thread Bat
Is there someone interested by that big problem?

On 31 déc 2011, 22:36, J jem...@gmail.com wrote:
 One more thing, I am running Eclipse 3.7 as well as 3.6.

 HTH

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Failed to initialize App Engine SDK at ... appengine-java-sdk-1.6.0

2011-12-30 Thread Bat
Hi,

I've exactly the same problem as you. I also run eclipse indigo on mac
os and I'd like to use the sdk GAE 1.6.1. Unfortunately, I've this
error message Failed to initialize App Engine SDK -1.6.1 when I want
to create new web application project.

Have you found the solution?

Thanks

On 29 nov, 00:20, AnthoniS anthoni.schioc...@eliium.com wrote:
 Hello,

 When the gae SDK 1.6.0 was released, I tried using Eclipse (actually,
 SpringSource Tool Suite, aka STS) to upgrade. Unfortunately, the new
 version of the gae SDK was not suggested in the Check for Updates
 wizard of the Help menu of STS
 So I downloaded the SDK manually and tried to add it in the Google
 SDKs section of Eclipse Preferences menu. It failed, with the error
 message: Failed to initialize App Engine SDK at path-to-gae-sdk/
 appengine-java-sdk-1.6.0. So I removed this version and continued
 developping with the version 1.5.5.
 One week later, I suddenly got the notification in STS there is an
 update of Google plugin which popped out from the bottom of the
 screen. Great! Finally Eclipse had seen the update of the SDK ! I
 immediately run the wizard, downloaded the SDK, and finally restarted
 Eclipse (well, STS) normally. But after restart, the new installed SDK
 was still in a corrupted state with the same error message.
 I run STS 2.3.3M1 (built on Eclipse distrib 3.5.2) on a MacOSX 10.5.8
 with JDK 6.0.

 Have you ever got this problem ? Thank you.

 In the ErrorLog message of STS, I got this stack trace:
 Unexpected Exception
 java.lang.UnsupportedClassVersionError: Bad version number in .class
 file
         at java.lang.ClassLoader.defineClass2(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:775)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:
 160)
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:254)
         at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:317)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:375)
         at java.lang.Class.getDeclaredConstructors0(Native Method)
         at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
         at java.lang.Class.getConstructor0(Class.java:2671)
         at java.lang.Class.newInstance0(Class.java:321)
         at java.lang.Class.newInstance(Class.java:303)
         at
 com.google.appengine.eclipse.core.sdk.AppEngineBridgeFactory.createBridge(A 
 ppEngineBridgeFactory.java:
 184)
         at
 com.google.appengine.eclipse.core.sdk.AppEngineBridgeFactory.createBridge(A 
 ppEngineBridgeFactory.java:
 122)
         at
 com.google.appengine.eclipse.core.sdk.AppEngineBridgeFactory.getAppEngineBr 
 idge(AppEngineBridgeFactory.java:
 95)
         at
 com.google.appengine.eclipse.core.sdk.GaeSdk.getAppEngineBridge(GaeSdk.java :
 265)
         at com.google.appengine.eclipse.core.sdk.GaeSdk.validate(GaeSdk.java:
 379)
         at
 com.google.gdt.eclipse.core.ui.AddSdkDialog.validateSdk(AddSdkDialog.java:
 268)
         at
 com.google.gdt.eclipse.core.ui.AddSdkDialog.validate(AddSdkDialog.java:
 214)
         at com.google.gdt.eclipse.core.ui.AddSdkDialog
 $4.modifyText(AddSdkDialog.java:177)
         at
 org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:
 167)
         at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
         at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1598)
         at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1622)
         at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1603)
         at org.eclipse.swt.widgets.Text.sendModifyEvent(Text.java:1854)
         at org.eclipse.swt.widgets.Text.setText(Text.java:2314)
         at com.google.gdt.eclipse.core.ui.AddSdkDialog
 $2.widgetSelected(AddSdkDialog.java:154)
         at
 org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:
 228)
         at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
         at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1598)
         at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1622)
         at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1607)
         at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1396)
         at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:
 3484)
         at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3068)
         at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
         at org.eclipse.jface.window.Window.open(Window.java:801)
         at com.google.appengine.eclipse.core.preferences.ui.GaePreferencePage
 

[google-appengine] Attachment in mail

2011-12-12 Thread Bat
Hi,

One of my servlet creates CSV content in a String variable.

I'd like to send this CSV like an attachment file but everybody knows
the limitations of GAE : it's impossible to create a file. So, I
decided to find an another solution.

Mine is to attach the CSV string like that :
String csv = ;
Message msg = new MimeMessage(session);
msg.setDataHandler(new DataHandler(new
ByteArrayDataSource(csv.getBytes(),text/csv)));
msg.setFileName(data.csv);

I receive the mail but without attachment. The CSV string is
integrated into the body part of the mail.

How to attach this CSV string like a CSV file into the mail?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: Problem with blobstoreService.getUploadedBlobs(request)

2011-09-29 Thread Bat
I think that in all cases, if I send a form without file inside,
google blobstore create an empty blob...
I can see it in Blobstore vievwer.

This strange behavior is only on the google server, not on
localhost...

On 28 sep, 17:25, Bat batistutagabrielf...@gmail.com wrote:
 Hi,

 I've a problem with the methode blobstoreService.getUploadedBlobs().
 I've a JSP page in wich one I set an uploader like this :

 formname='form'  action='%= blobstoreService.createUploadUrl(/
 Edit_Engine) %' method='POST' enctype='multipart/form-data' 
 input label='...' multiple='false' name='myFile' /
 //...and multiple input for text
 /form

 and I retrieve this code with my servlet :

 java.util.MapString,BlobKey blobs =
 blobstoreService.getUploadedBlobs(req);
 BlobKey blobK  = blobs.get(myFiles[]); //I don't know why I need to
 add the characters 's[]' at the end...

 But the behavior is strange. The first time I upload an image,
 everything works. However, the second time, I send my form without
 uploading somehting (only text data), and then my java code finds a
 BlobKey. But this BlobKey seems to be the previous sended data, or a
 corrupted data.
 I mean that not normal, because when I deploy this version on my
 localhost, if the form uploads no file the method getUploadedBlobs
 returns an empty HashMap. However, when I deploy on google servers, if
 the form uploads no file, the method getUploadedBlobs seems  to return
 a HashMap with wrong data.

 Could you help me? Or tell me if this behaviro is normal...

 Many thanks,

 bat

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Problem with blobstoreService.getUploadedBlobs(request)

2011-09-28 Thread Bat
Hi,

I've a problem with the methode blobstoreService.getUploadedBlobs().
I've a JSP page in wich one I set an uploader like this :

formname='form'  action='%= blobstoreService.createUploadUrl(/
Edit_Engine) %' method='POST' enctype='multipart/form-data' 
input label='...' multiple='false' name='myFile' /
//...and multiple input for text
/form

and I retrieve this code with my servlet :

java.util.MapString,BlobKey blobs =
blobstoreService.getUploadedBlobs(req);
BlobKey blobK  = blobs.get(myFiles[]); //I don't know why I need to
add the characters 's[]' at the end...

But the behavior is strange. The first time I upload an image,
everything works. However, the second time, I send my form without
uploading somehting (only text data), and then my java code finds a
BlobKey. But this BlobKey seems to be the previous sended data, or a
corrupted data.
I mean that not normal, because when I deploy this version on my
localhost, if the form uploads no file the method getUploadedBlobs
returns an empty HashMap. However, when I deploy on google servers, if
the form uploads no file, the method getUploadedBlobs seems  to return
a HashMap with wrong data.

Could you help me? Or tell me if this behaviro is normal...

Many thanks,

bat

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Updating problem with unkowned relation

2011-08-29 Thread Bat
I've 2 simple classes :

public class Student {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
   com.google.appengine.api.datastore.Key key;
@Persistent
   public String firstName;
@Persistent
   public String lastName;
}
And

public class Teacher {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
com.google.appengine.api.datastore.Key key;
@Persistent
public String firstName;
@Persistent
public String lastName;
@Persistent
public com.google.appengine.api.datastore.Key student;
}

First, I create a Teacher with only the fields 'firstname' 
'lastname' filled. It works. Then, I update my teacher with this
code :

Transaction tx = pm.currentTransaction();
  tx.begin();
  Teacher a = pm.getObjectById(Teacher.class,
KeyFactory.stringToKey( the_key));
  if(a != null) {
  try {
  a.setFirstName(test);
  a.setLastName(test);
  a.student = KeyFactory.stringToKey( req.getParameter(student101-
key));
  tx.commit();
  }
  }
  pm.close();
  }
  }
After this transaction, the fields firstname  lastname are
correctly updated. However, the field student is still null. Do you
know Why?

Thank you very much

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[appengine-java] Re: Xstream patched

2011-01-27 Thread Bat
Thanks.

However, I've tryed with your .jar but I still have the save problem. Here 
is the error :

java.lang.NoClassDefFoundError: sun.reflect.ReflectionFactory is a restricted 
class. Please see the Google App Engine developer's guide for more details.
at 
com.google.apphosting.runtime.security.shared.stub.sun.reflect.ReflectionFactory.clinit(ReflectionFactory.java)
at 
com.thoughtworks.xstream.converters.reflection.Sun14ReflectionProvider.getLazyRefectionFactory(Sun14ReflectionProvider.java:105)
at 
com.thoughtworks.xstream.converters.reflection.Sun14ReflectionProvider.getMungedConstructor(Sun14ReflectionProvider.java:97)
at 
com.thoughtworks.xstream.converters.reflection.Sun14ReflectionProvider.newInstance(Sun14ReflectionProvider.java:76)
at 
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.instantiateNewInstance(AbstractReflectionConverter.java:313)
at 
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:162)
at 
com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:82)
at 
com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:63)
at 
com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:76)
at 
com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:60)
at 
com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:137)
at 
com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:33)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:965)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:950)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:893)

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Xstream patched

2011-01-27 Thread Bat
Wich source..? I only call :
XStream xstream = new XStream(new DomDriver());
InputStream input = new FileInputStream(WEB-INF/myFile.xml);

And the class serialize are standard...

What does the patch improve into the source of xstream?

Many thanks

On 27 jan, 15:38, Charms Styler charmssty...@gmail.com wrote:
 Wel I have been using it on my apps too, I suggest your post your source.

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Xstream patched

2011-01-26 Thread Bat
Nobody has such jar file?

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Xstream patched

2011-01-25 Thread Bat
Hi,

I saw that everybody had some problems with XStream and Gae due to the 
restriction of google. Is there someone who has the xstream.jar that can run 
correctly on the server of google. I mean the .jar builded with the patch 
located at this url :http://jira.codehaus.org/browse/XSTR-566.

Thanks in advance,

Bat

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.