How to upload image with a product object through Hibernate in Spring MVCSpring MVC Multipart Request with JSONHow to handle static content in Spring MVC?Trigger 404 in Spring-MVC controller?How does autowiring work in Spring?What is @ModelAttribute in Spring MVC?Spring MVC: How to return image in @ResponseBody?How do I POST JSON data with Curl from a terminal/commandline to Test Spring REST?Spring MVC - How to get all request params in a map in Spring controller?How to respond with HTTP 400 error in a Spring MVC @ResponseBody method returning String?Spring MVC @PathVariable with dot (.) is getting truncatedHow to configure port for a Spring Boot application
Alias for root of a polynomial
How can I add a .pem private key fingerprint entry to known_hosts before connecting with ssh?
How can two continuations cancel each other out?
Automation Engine activity type not retrieving custom facet
Unexpected Netflix account registered to my Gmail address - any way it could be a hack attempt?
Is it safe to use two single-pole breakers for a 240 V circuit?
Why can't I share a one use code with anyone else?
What dog breeds survive the apocalypse for generations?
How to continually let my readers know what time it is in my story, in an organic way?
Substring join or additional table, which is faster?
How might a landlocked lake become a complete ecosystem?
How does this Martian habitat 3D printer built for NASA work?
How about space ziplines
How to cope with regret and shame about not fully utilizing opportunities during PhD?
Why does SSL Labs now consider CBC suites weak?
Do Grothendieck universes matter for an algebraic geometer?
Filter a data-frame and add a new column according to the given condition
Are there any sonatas with only two sections?
Polynomial division: Is this trick obvious?
Given 0s on Assignments with suspected and dismissed cheating?
Would life always name the light from their sun "white"
The meaning of the Middle English word “king”
Why is it harder to turn a motor/generator with shorted terminals?
Is 95% of what you read in the financial press “either wrong or irrelevant?”
How to upload image with a product object through Hibernate in Spring MVC
Spring MVC Multipart Request with JSONHow to handle static content in Spring MVC?Trigger 404 in Spring-MVC controller?How does autowiring work in Spring?What is @ModelAttribute in Spring MVC?Spring MVC: How to return image in @ResponseBody?How do I POST JSON data with Curl from a terminal/commandline to Test Spring REST?Spring MVC - How to get all request params in a map in Spring controller?How to respond with HTTP 400 error in a Spring MVC @ResponseBody method returning String?Spring MVC @PathVariable with dot (.) is getting truncatedHow to configure port for a Spring Boot application
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have an angular form where I fill fields for a product and then I select images. I've added following configuration in AppConfig in SpringMVC project to enable MultiPart Files.
@Bean(name = "multipartResolver")
public CommonsMultipartResolver multipartResolver()
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
multipartResolver.setMaxUploadSize(1000000);
return multipartResolver;
I've also added a transient field in my Product Model for images like this:
@Transient
private List<MultipartFile> productImages;
Since I want to receive the Product object separately inside the controller I'm using @RequestPart
to fetch both separately like this:
@RequestMapping(value = "save", method = RequestMethod.POST)
public ResponseEntity addProduct(@Valid @RequestPart Product product, @RequestPart MultipartFile[] images, BindingResult bindingResult, HttpServletRequest
}
And on the frontend inside Angular, I'm trying to use FormData
to help with this.
let formData = new FormData();
formData.append('product', new Blob([JSON.stringify(this.product)], type: "application/json" ));
// I iterate and append all the images like this
formData.append('image[]', this.images, this.images.name);
this.http.post(this.appService.getApiUrl() + "api/product/save/", product);
The problem is that whenever I submit the form, I get this exception as a response:
HTTP Status 415 – Unsupported Media Type
I had an HttpInterceptor that appended an application/json header for Content-Type, I removed it because of it I was getting HTTP Status 400 – Bad Request.
At this point, I do not know what's the problem, I don't know how to debug the front facing spring mvc stuff, I can only debug through breakpoints within a controller method but the problem arises well before.
angular spring spring-mvc primeng
add a comment |
I have an angular form where I fill fields for a product and then I select images. I've added following configuration in AppConfig in SpringMVC project to enable MultiPart Files.
@Bean(name = "multipartResolver")
public CommonsMultipartResolver multipartResolver()
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
multipartResolver.setMaxUploadSize(1000000);
return multipartResolver;
I've also added a transient field in my Product Model for images like this:
@Transient
private List<MultipartFile> productImages;
Since I want to receive the Product object separately inside the controller I'm using @RequestPart
to fetch both separately like this:
@RequestMapping(value = "save", method = RequestMethod.POST)
public ResponseEntity addProduct(@Valid @RequestPart Product product, @RequestPart MultipartFile[] images, BindingResult bindingResult, HttpServletRequest
}
And on the frontend inside Angular, I'm trying to use FormData
to help with this.
let formData = new FormData();
formData.append('product', new Blob([JSON.stringify(this.product)], type: "application/json" ));
// I iterate and append all the images like this
formData.append('image[]', this.images, this.images.name);
this.http.post(this.appService.getApiUrl() + "api/product/save/", product);
The problem is that whenever I submit the form, I get this exception as a response:
HTTP Status 415 – Unsupported Media Type
I had an HttpInterceptor that appended an application/json header for Content-Type, I removed it because of it I was getting HTTP Status 400 – Bad Request.
At this point, I do not know what's the problem, I don't know how to debug the front facing spring mvc stuff, I can only debug through breakpoints within a controller method but the problem arises well before.
angular spring spring-mvc primeng
Did you checked stackoverflow.com/questions/21329426/… ?
– Asif Shahzad
Mar 25 at 13:12
add a comment |
I have an angular form where I fill fields for a product and then I select images. I've added following configuration in AppConfig in SpringMVC project to enable MultiPart Files.
@Bean(name = "multipartResolver")
public CommonsMultipartResolver multipartResolver()
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
multipartResolver.setMaxUploadSize(1000000);
return multipartResolver;
I've also added a transient field in my Product Model for images like this:
@Transient
private List<MultipartFile> productImages;
Since I want to receive the Product object separately inside the controller I'm using @RequestPart
to fetch both separately like this:
@RequestMapping(value = "save", method = RequestMethod.POST)
public ResponseEntity addProduct(@Valid @RequestPart Product product, @RequestPart MultipartFile[] images, BindingResult bindingResult, HttpServletRequest
}
And on the frontend inside Angular, I'm trying to use FormData
to help with this.
let formData = new FormData();
formData.append('product', new Blob([JSON.stringify(this.product)], type: "application/json" ));
// I iterate and append all the images like this
formData.append('image[]', this.images, this.images.name);
this.http.post(this.appService.getApiUrl() + "api/product/save/", product);
The problem is that whenever I submit the form, I get this exception as a response:
HTTP Status 415 – Unsupported Media Type
I had an HttpInterceptor that appended an application/json header for Content-Type, I removed it because of it I was getting HTTP Status 400 – Bad Request.
At this point, I do not know what's the problem, I don't know how to debug the front facing spring mvc stuff, I can only debug through breakpoints within a controller method but the problem arises well before.
angular spring spring-mvc primeng
I have an angular form where I fill fields for a product and then I select images. I've added following configuration in AppConfig in SpringMVC project to enable MultiPart Files.
@Bean(name = "multipartResolver")
public CommonsMultipartResolver multipartResolver()
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
multipartResolver.setMaxUploadSize(1000000);
return multipartResolver;
I've also added a transient field in my Product Model for images like this:
@Transient
private List<MultipartFile> productImages;
Since I want to receive the Product object separately inside the controller I'm using @RequestPart
to fetch both separately like this:
@RequestMapping(value = "save", method = RequestMethod.POST)
public ResponseEntity addProduct(@Valid @RequestPart Product product, @RequestPart MultipartFile[] images, BindingResult bindingResult, HttpServletRequest
}
And on the frontend inside Angular, I'm trying to use FormData
to help with this.
let formData = new FormData();
formData.append('product', new Blob([JSON.stringify(this.product)], type: "application/json" ));
// I iterate and append all the images like this
formData.append('image[]', this.images, this.images.name);
this.http.post(this.appService.getApiUrl() + "api/product/save/", product);
The problem is that whenever I submit the form, I get this exception as a response:
HTTP Status 415 – Unsupported Media Type
I had an HttpInterceptor that appended an application/json header for Content-Type, I removed it because of it I was getting HTTP Status 400 – Bad Request.
At this point, I do not know what's the problem, I don't know how to debug the front facing spring mvc stuff, I can only debug through breakpoints within a controller method but the problem arises well before.
angular spring spring-mvc primeng
angular spring spring-mvc primeng
asked Mar 23 at 14:40
Faisal ZulfiqarFaisal Zulfiqar
2715
2715
Did you checked stackoverflow.com/questions/21329426/… ?
– Asif Shahzad
Mar 25 at 13:12
add a comment |
Did you checked stackoverflow.com/questions/21329426/… ?
– Asif Shahzad
Mar 25 at 13:12
Did you checked stackoverflow.com/questions/21329426/… ?
– Asif Shahzad
Mar 25 at 13:12
Did you checked stackoverflow.com/questions/21329426/… ?
– Asif Shahzad
Mar 25 at 13:12
add a comment |
1 Answer
1
active
oldest
votes
I think you would have to send a multipart/related request but last time I checked Angular does not support that.
Regardless, you are implementing way more code than you need to there. Why don't you take a look at Spring Content. This is designed to associate content with Spring Data entities, as you are trying to do, using the same (or very similar programming model) as Spring Data.
You might add it to your project as follows:
pom.xml
<!-- Java API -->
<dependency>
<groupId>com.github.paulcwarren</groupId>
<artifactId>spring-content-fs-boot-starter</artifactId>
<version>0.7.0</version>
</dependency>
<!-- REST API -->
<dependency>
<groupId>com.github.paulcwarren</groupId>
<artifactId>spring-content-rest-boot-starter</artifactId>
<version>0.7.0</version>
</dependency>
FilesystemConfiguration.java
@Configuration
public class FilesystemConfiguration
@Bean
File filesystemRoot()
try
return new File("/path/to/your/product/images");
catch (IOException ioe)
return null;
@Bean
FileSystemResourceLoader fileSystemResourceLoader()
return new FileSystemResourceLoader(filesystemRoot().getAbsolutePath());
Product.java
@Entity
public class Product
@Id
@GeneratedValue
private long id;
...other existing fields...
@ContentId
private String contentId;
@ContentLength
private long contentLength = 0L;
@MimeType
private String mimeType = "text/plain";
...
ProductContentStore.java
@StoreRestResource(path="productImages")
public interface ProductContentStore extends ContentStore<Product, String>
This is all you need to do to get REST Endpoints that will allow you to store and retrieve content associated with each Product. How this actually works is very much like Spring Data. When your application starts Spring Content will see the spring-content-fs-boot-starter
dependencies and know that you want to store content on the filesystem. It will inject a Filesystem-based implementation of the ProductContentStore
interface. It will also see the spring-content-rest-boot-starter
and will inject REST endpoints that talk to the content store interface. Meaning you don't have to write any of this code yourself.
So, for example:
curl -X POST /productImages/productId -F "file=@/path/to/image.jpg"
will store the image on the filesystem and associate it with the product entity whose id is productId
.
curl /productImages/productId
will fetch it again and so on...supports full CRUD and video streaming too actually BTW.
You could also decide to store the contents elsewhere like in the database (as someone commented), or in S3 by swapping the spring-content-fs-boot-starter
dependency for the appropriate Spring Content Storage module. Examples for every type of storage are here.
In summary, angular (and other popular frontends) don't, at time of writing, support multipart/related
that is, in my opinion, the correct type of request for uploading content related to entities. In lieu of that Spring Content and your solution will have to use separate requests to; firstly to create the entity and the secondly associate the content with that entity.
HTH
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55314851%2fhow-to-upload-image-with-a-product-object-through-hibernate-in-spring-mvc%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I think you would have to send a multipart/related request but last time I checked Angular does not support that.
Regardless, you are implementing way more code than you need to there. Why don't you take a look at Spring Content. This is designed to associate content with Spring Data entities, as you are trying to do, using the same (or very similar programming model) as Spring Data.
You might add it to your project as follows:
pom.xml
<!-- Java API -->
<dependency>
<groupId>com.github.paulcwarren</groupId>
<artifactId>spring-content-fs-boot-starter</artifactId>
<version>0.7.0</version>
</dependency>
<!-- REST API -->
<dependency>
<groupId>com.github.paulcwarren</groupId>
<artifactId>spring-content-rest-boot-starter</artifactId>
<version>0.7.0</version>
</dependency>
FilesystemConfiguration.java
@Configuration
public class FilesystemConfiguration
@Bean
File filesystemRoot()
try
return new File("/path/to/your/product/images");
catch (IOException ioe)
return null;
@Bean
FileSystemResourceLoader fileSystemResourceLoader()
return new FileSystemResourceLoader(filesystemRoot().getAbsolutePath());
Product.java
@Entity
public class Product
@Id
@GeneratedValue
private long id;
...other existing fields...
@ContentId
private String contentId;
@ContentLength
private long contentLength = 0L;
@MimeType
private String mimeType = "text/plain";
...
ProductContentStore.java
@StoreRestResource(path="productImages")
public interface ProductContentStore extends ContentStore<Product, String>
This is all you need to do to get REST Endpoints that will allow you to store and retrieve content associated with each Product. How this actually works is very much like Spring Data. When your application starts Spring Content will see the spring-content-fs-boot-starter
dependencies and know that you want to store content on the filesystem. It will inject a Filesystem-based implementation of the ProductContentStore
interface. It will also see the spring-content-rest-boot-starter
and will inject REST endpoints that talk to the content store interface. Meaning you don't have to write any of this code yourself.
So, for example:
curl -X POST /productImages/productId -F "file=@/path/to/image.jpg"
will store the image on the filesystem and associate it with the product entity whose id is productId
.
curl /productImages/productId
will fetch it again and so on...supports full CRUD and video streaming too actually BTW.
You could also decide to store the contents elsewhere like in the database (as someone commented), or in S3 by swapping the spring-content-fs-boot-starter
dependency for the appropriate Spring Content Storage module. Examples for every type of storage are here.
In summary, angular (and other popular frontends) don't, at time of writing, support multipart/related
that is, in my opinion, the correct type of request for uploading content related to entities. In lieu of that Spring Content and your solution will have to use separate requests to; firstly to create the entity and the secondly associate the content with that entity.
HTH
add a comment |
I think you would have to send a multipart/related request but last time I checked Angular does not support that.
Regardless, you are implementing way more code than you need to there. Why don't you take a look at Spring Content. This is designed to associate content with Spring Data entities, as you are trying to do, using the same (or very similar programming model) as Spring Data.
You might add it to your project as follows:
pom.xml
<!-- Java API -->
<dependency>
<groupId>com.github.paulcwarren</groupId>
<artifactId>spring-content-fs-boot-starter</artifactId>
<version>0.7.0</version>
</dependency>
<!-- REST API -->
<dependency>
<groupId>com.github.paulcwarren</groupId>
<artifactId>spring-content-rest-boot-starter</artifactId>
<version>0.7.0</version>
</dependency>
FilesystemConfiguration.java
@Configuration
public class FilesystemConfiguration
@Bean
File filesystemRoot()
try
return new File("/path/to/your/product/images");
catch (IOException ioe)
return null;
@Bean
FileSystemResourceLoader fileSystemResourceLoader()
return new FileSystemResourceLoader(filesystemRoot().getAbsolutePath());
Product.java
@Entity
public class Product
@Id
@GeneratedValue
private long id;
...other existing fields...
@ContentId
private String contentId;
@ContentLength
private long contentLength = 0L;
@MimeType
private String mimeType = "text/plain";
...
ProductContentStore.java
@StoreRestResource(path="productImages")
public interface ProductContentStore extends ContentStore<Product, String>
This is all you need to do to get REST Endpoints that will allow you to store and retrieve content associated with each Product. How this actually works is very much like Spring Data. When your application starts Spring Content will see the spring-content-fs-boot-starter
dependencies and know that you want to store content on the filesystem. It will inject a Filesystem-based implementation of the ProductContentStore
interface. It will also see the spring-content-rest-boot-starter
and will inject REST endpoints that talk to the content store interface. Meaning you don't have to write any of this code yourself.
So, for example:
curl -X POST /productImages/productId -F "file=@/path/to/image.jpg"
will store the image on the filesystem and associate it with the product entity whose id is productId
.
curl /productImages/productId
will fetch it again and so on...supports full CRUD and video streaming too actually BTW.
You could also decide to store the contents elsewhere like in the database (as someone commented), or in S3 by swapping the spring-content-fs-boot-starter
dependency for the appropriate Spring Content Storage module. Examples for every type of storage are here.
In summary, angular (and other popular frontends) don't, at time of writing, support multipart/related
that is, in my opinion, the correct type of request for uploading content related to entities. In lieu of that Spring Content and your solution will have to use separate requests to; firstly to create the entity and the secondly associate the content with that entity.
HTH
add a comment |
I think you would have to send a multipart/related request but last time I checked Angular does not support that.
Regardless, you are implementing way more code than you need to there. Why don't you take a look at Spring Content. This is designed to associate content with Spring Data entities, as you are trying to do, using the same (or very similar programming model) as Spring Data.
You might add it to your project as follows:
pom.xml
<!-- Java API -->
<dependency>
<groupId>com.github.paulcwarren</groupId>
<artifactId>spring-content-fs-boot-starter</artifactId>
<version>0.7.0</version>
</dependency>
<!-- REST API -->
<dependency>
<groupId>com.github.paulcwarren</groupId>
<artifactId>spring-content-rest-boot-starter</artifactId>
<version>0.7.0</version>
</dependency>
FilesystemConfiguration.java
@Configuration
public class FilesystemConfiguration
@Bean
File filesystemRoot()
try
return new File("/path/to/your/product/images");
catch (IOException ioe)
return null;
@Bean
FileSystemResourceLoader fileSystemResourceLoader()
return new FileSystemResourceLoader(filesystemRoot().getAbsolutePath());
Product.java
@Entity
public class Product
@Id
@GeneratedValue
private long id;
...other existing fields...
@ContentId
private String contentId;
@ContentLength
private long contentLength = 0L;
@MimeType
private String mimeType = "text/plain";
...
ProductContentStore.java
@StoreRestResource(path="productImages")
public interface ProductContentStore extends ContentStore<Product, String>
This is all you need to do to get REST Endpoints that will allow you to store and retrieve content associated with each Product. How this actually works is very much like Spring Data. When your application starts Spring Content will see the spring-content-fs-boot-starter
dependencies and know that you want to store content on the filesystem. It will inject a Filesystem-based implementation of the ProductContentStore
interface. It will also see the spring-content-rest-boot-starter
and will inject REST endpoints that talk to the content store interface. Meaning you don't have to write any of this code yourself.
So, for example:
curl -X POST /productImages/productId -F "file=@/path/to/image.jpg"
will store the image on the filesystem and associate it with the product entity whose id is productId
.
curl /productImages/productId
will fetch it again and so on...supports full CRUD and video streaming too actually BTW.
You could also decide to store the contents elsewhere like in the database (as someone commented), or in S3 by swapping the spring-content-fs-boot-starter
dependency for the appropriate Spring Content Storage module. Examples for every type of storage are here.
In summary, angular (and other popular frontends) don't, at time of writing, support multipart/related
that is, in my opinion, the correct type of request for uploading content related to entities. In lieu of that Spring Content and your solution will have to use separate requests to; firstly to create the entity and the secondly associate the content with that entity.
HTH
I think you would have to send a multipart/related request but last time I checked Angular does not support that.
Regardless, you are implementing way more code than you need to there. Why don't you take a look at Spring Content. This is designed to associate content with Spring Data entities, as you are trying to do, using the same (or very similar programming model) as Spring Data.
You might add it to your project as follows:
pom.xml
<!-- Java API -->
<dependency>
<groupId>com.github.paulcwarren</groupId>
<artifactId>spring-content-fs-boot-starter</artifactId>
<version>0.7.0</version>
</dependency>
<!-- REST API -->
<dependency>
<groupId>com.github.paulcwarren</groupId>
<artifactId>spring-content-rest-boot-starter</artifactId>
<version>0.7.0</version>
</dependency>
FilesystemConfiguration.java
@Configuration
public class FilesystemConfiguration
@Bean
File filesystemRoot()
try
return new File("/path/to/your/product/images");
catch (IOException ioe)
return null;
@Bean
FileSystemResourceLoader fileSystemResourceLoader()
return new FileSystemResourceLoader(filesystemRoot().getAbsolutePath());
Product.java
@Entity
public class Product
@Id
@GeneratedValue
private long id;
...other existing fields...
@ContentId
private String contentId;
@ContentLength
private long contentLength = 0L;
@MimeType
private String mimeType = "text/plain";
...
ProductContentStore.java
@StoreRestResource(path="productImages")
public interface ProductContentStore extends ContentStore<Product, String>
This is all you need to do to get REST Endpoints that will allow you to store and retrieve content associated with each Product. How this actually works is very much like Spring Data. When your application starts Spring Content will see the spring-content-fs-boot-starter
dependencies and know that you want to store content on the filesystem. It will inject a Filesystem-based implementation of the ProductContentStore
interface. It will also see the spring-content-rest-boot-starter
and will inject REST endpoints that talk to the content store interface. Meaning you don't have to write any of this code yourself.
So, for example:
curl -X POST /productImages/productId -F "file=@/path/to/image.jpg"
will store the image on the filesystem and associate it with the product entity whose id is productId
.
curl /productImages/productId
will fetch it again and so on...supports full CRUD and video streaming too actually BTW.
You could also decide to store the contents elsewhere like in the database (as someone commented), or in S3 by swapping the spring-content-fs-boot-starter
dependency for the appropriate Spring Content Storage module. Examples for every type of storage are here.
In summary, angular (and other popular frontends) don't, at time of writing, support multipart/related
that is, in my opinion, the correct type of request for uploading content related to entities. In lieu of that Spring Content and your solution will have to use separate requests to; firstly to create the entity and the secondly associate the content with that entity.
HTH
edited Mar 25 at 15:09
answered Mar 25 at 15:02
Paul WarrenPaul Warren
1,3531819
1,3531819
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55314851%2fhow-to-upload-image-with-a-product-object-through-hibernate-in-spring-mvc%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did you checked stackoverflow.com/questions/21329426/… ?
– Asif Shahzad
Mar 25 at 13:12