I have a domain object that contains another domain object; call them A and B. B contains a blob (image file), which can be large. So far I only deal with one A at a time when B on A is not a concern. However, sometimes I will deal with thousands of A, in which the transfer around the blob to B leads to the end of the heap. When I deal with so many A, I really don't need Anyway.
Is there a way to tell Hibernate to ignore this property for a specific call? Should I just do transition B and solve the problem of updating / deleting manually in this case?
Right now, to get around this problem, I'm using an SQL query to pull out all the identifiers I want, then iterate over this list, getting each domain object, doing what I need, and then popping it out.
Also, I can't lazy loading B because I'm in a servlet environment, so my Hibernate session is closed before I get access to properties in most cases.
@Entity @Table(name="A") public class A { private Long id @OneToOne(fetch = FetchType.EAGER, cascade = { CascadeType.ALL }, orphanRemoval = true) @JoinColumn(name = "a_id", referencedColumnName = "b_id", nullable = true) @NotFound(action = NotFoundAction.IGNORE) private B b ...getters and setters } @Entity @Table(name="B") public class B { private Long id; private byte[] blob; ...getters and setters }
thanks
source share