Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot resolve type description for java.sql.Blob #277

Closed
alesj opened this issue Dec 17, 2020 · 4 comments
Closed

Cannot resolve type description for java.sql.Blob #277

alesj opened this issue Dec 17, 2020 · 4 comments
Assignees
Milestone

Comments

@alesj
Copy link

alesj commented Dec 17, 2020

The build fails with mvnd, where it works with plain mvn.

The Image class:

@Entity
@Table(
        name = Image.TABLE_NAME,
        uniqueConstraints = @UniqueConstraint(name = Image.PK_CONSTRAINT_NAME, columnNames = {"name"})
)
public class Image extends AbstractEntity {
    public static final String TABLE_NAME = "image";
    public static final String PK_CONSTRAINT_NAME = TABLE_NAME + "_pkey";

    @Column(nullable = false)
    private String name;
    @Lob
    private Blob blob;
    private String mimeType;
    private long length;
    @ManyToOne(fetch = FetchType.LAZY)
    private User user;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMimeType() {
        return mimeType;
    }

    public void setMimeType(String mimeType) {
        this.mimeType = mimeType;
    }

    public long getLength() {
        return length;
    }

    public void setLength(long length) {
        this.length = length;
    }

    public Blob getBlob() {
        return blob;
    }

    public void setBlob(Blob blob) {
        this.blob = blob;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public void write(byte[] bytes) throws Exception {
        blob = new SerialBlob(bytes);
    }

    public byte[] read() throws IOException {
        if (blob == null)
            return null;

        try {
            return blob.getBytes(1, (int) blob.length() + 1);
        } catch (SQLException e) {
            throw new IOException(e.getMessage(), e);
        }
    }

    public InputStream stream() throws IOException {
        try {
            return (blob != null) ? blob.getBinaryStream() : null;
        } catch (SQLException e) {
            throw new IOException(e.getMessage(), e);
        }
    }
}
@ppalaga
Copy link
Contributor

ppalaga commented Dec 17, 2020

Is the reproducer project accessible somewhere?

@alesj
Copy link
Author

alesj commented Dec 17, 2020

@ppalaga unfortunately no

@alesj
Copy link
Author

alesj commented Dec 17, 2020

Let me see if I can quickly hack some similar simple mock ...

@alesj
Copy link
Author

alesj commented Dec 17, 2020

@ppalaga @gnodet try this ... it fails in same way for me ...

gnodet added a commit to gnodet/mvnd that referenced this issue Jan 22, 2021
@gnodet gnodet self-assigned this Jan 22, 2021
@gnodet gnodet added this to the 0.4.0 milestone Jan 22, 2021
@gnodet gnodet closed this as completed in 92ddff9 Jan 22, 2021
gnodet added a commit that referenced this issue Jan 22, 2021
Fix JVM resource loading from plugins, fixes #277
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants