-2
Iqeria know how to insert images into the database so that when I can search the image and its data appear.
-2
Iqeria know how to insert images into the database so that when I can search the image and its data appear.
0
You can create a class with byte array property.
I will illustrate a way using Spring Boot with JPA:
First, we create the class that represents the model in the database. @Lob represents the type blob in the database, where bytes of the image will be stored.
@Entity
public class Document {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Long id;
@Lob
private byte[] content;
//get e set omitidos
}
With that, just persist in the bank, with Spring Data, it would be something like this:
documentRepository.save(document);
0
Hello, you can create a table in your database with the following columns:
table: file columns: length (integer), content_type (Character Varying), id (integer), content (bytea), name (Character Varying);
In your java class you would have:
private string name; private String contenttype; long private length; Private inputstream content;
Browser other questions tagged java database netbeans
You are not signed in. Login or sign up in order to post.