Hello guys i have the the xpertivy v5....following process: User have to upload a pdf file. #1 Step The pdf file have to save into a postsql db (bytea field). #2 Step The user have to open the file from db What have i done? I created a java method. I can save and read a pdf from the postsqldb but it wont work in the xpert ivy process. How can i fetch a file over the fileinputstream with the databasestep and write it to the db? How can i read the file over the db step? Thank you so much for your help asked 13.10.2014 at 15:37 MaxIvy |
I guess you did something like this: UI-Dialog:
Due to this is a primeface-action there should be no problem with this. Your Java-Class:
The byte[] you now can save to your database as bytea. In case you wonder how the persistence could be implemented: Dataclass:
Persistence class:
And now you can add these line to save your files:
Hope this helps a bit. answered 14.10.2014 at 08:38 Daniel Oechslin |
Hi Daniel, Thank you for your answer. I tried this of course, but i wont work. Look at the screen Im am not sure whats wrong answered 01.12.2014 at 13:39 MaxIvy You added the database correctly. Hence you need to add the persistence as well. Add a persistence called "antraege" with the datasource "antraege". Then the configuration part is done. Now you can provide the name "antraege" from your persistence configuration as a String to your configuration: IIvyEntityManager entitymanager= Ivy.persistence().get("antraege");
(01.12.2014 at 13:50)
Daniel Oechslin
OK thanks :-) i got i now one step more to my target. I have this database: antrage, where i want to save the pdf files to specific id from the formular. Where in the code have i put my Insert-into prepareStament line ("INSERT INTO antraege VALUES ? WHERE id=?) and how can i excute the statement... Thank u so much for your help.
(01.12.2014 at 14:56)
MaxIvy
IIvyQuery query = getEntityManager().createQuery("INSERT XXX"); query.setParameter("file", ...); query.executeUpdate()
(03.12.2014 at 13:10)
Reguel Werme... ♦♦
|
Hi MaxIvy below you see a sample database configuration. You can add your connection as shown in the picture and configure with the parameters you need and add the name- here: building as your myDatabaseContextName. Hope this helps Daniel answered 01.12.2014 at 11:41 Daniel Oechslin |
Thank you su much for your answer and soory that i get a little bit late get back: For the moment i got an error in this line IIvyEntityManager entityManager= Ivy.persistence().get(myDatabaseContextName); --> What have i put here inside? Thank u so much answered 01.12.2014 at 11:11 MaxIvy Added a new answer as response.
(01.12.2014 at 12:54)
Daniel Oechslin
|
Hi MaxIvy You can do it the very same as explained here: http://jeebestpractices.blogspot.ch/2011/03/save-images-into-database-postgres-with.html Just adjust the naming a little and remove the conversion part. answered 13.10.2014 at 16:02 Daniel Oechslin Yes my java code is like this example but it wont work in the dynamic ivy process. how can i start the javamethod from a processtep ( in the expample ImageToByte() ) from the ivy process ? The picture below is the the two option what i tried the option 2 wont work
(13.10.2014 at 16:09)
MaxIvy
|
Once you sign in you will be able to subscribe for any updates here
By RSS:Markdown Basics
Tags:
Asked: 13.10.2014 at 15:37
Seen: 11,279 times
Last updated: 03.12.2014 at 13:13