Answers for "Angular 8 fileupload +springboot + sql server"

0

endpoint to upload and retrieve image in database using spring boot

package com.vasu.SpringBootFileUpload.Model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;

/**
 *
 * @author Vasu Rajput
 */
@Entity
@Table(name = "ImageProfile")
public class MyModel {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "Id")
    private long id;

    @Column(name = "Name")
    private String name;

    @Lob
    @Column(name = "Image")
    private byte[] image;

    public MyModel() {
        super();
        // TODO Auto-generated constructor stub
    }
    public MyModel(String name, byte[] image) {
        super();
        this.name = name;
        this.image = image;
    }
    public long getId() {
        return id;
    }
    public void setId(long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public byte[] getImage() {
        return image;
    }
    public void setImage(byte[] image) {
        this.image = image;
    }
}
Posted by: Guest on June-09-2020
0

endpoint to upload and retrieve image in database using spring boot

package com.vasu.SpringBootFileUpload.Model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;

/**
 *
 * @author Vasu Rajput
 */
@Entity
@Table(name = "ImageProfile")
public class MyModel {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "Id")
    private long id;

    @Column(name = "Name")
    private String name;

    @Lob
    @Column(name = "Image")
    private byte[] image;

    public MyModel() {
        super();
        // TODO Auto-generated constructor stub
    }
    public MyModel(String name, byte[] image) {
        super();
        this.name = name;
        this.image = image;
    }
    public long getId() {
        return id;
    }
    public void setId(long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public byte[] getImage() {
        return image;
    }
    public void setImage(byte[] image) {
        this.image = image;
    }
}
Posted by: Guest on June-09-2020

Browse Popular Code Answers by Language