element « Load « JPA Q&A





1. How can I add an element to a lazily-loaded collection in Hibernate without causing the collection to load?    stackoverflow.com

What it says on the tin; I want to modify a collection in Hibernate without forcing the collection to load, since it is a large volume of data (~100,000 records, ...

2. Can no persist entity with lazy loading elements    stackoverflow.com

I have entities

@Entity public class A implements Serializable {
    @OneToMany(mappedBy = "a", fetch = FetchType.LAZY)
    private List<B> bList;
}

@Entity public class B implements Serializable{
   ...

3. Hibernate loads only first element of the collection    coderanch.com

I use Springs SimpleFormController to write Post objects into database: public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { if (command.getClass() != Post.class) throw new Exception("Command object of wrong type"); Blog blog = (Blog)request.getSession().getAttribute("blog"); Post newPost = (Post)command; newPost.setBlog(blog); blogDao.savePost(newPost); return new ModelAndView(getSuccessView()); } Then i load the blog using my dao in another controller: public ModelAndView ...

4. Loading child elements of several parents simultaneously    forum.hibernate.org

Suppose class A has a sole member, a Collection of class B, that must be lazy loaded. I query for a list of instances of A. Two instances are returned. Assume I cannot left join fetch the children. Is it possible to initialize all children of both instances of A in a single SQL statement? My impression is that batch-size only ...

5. Null element being added to a collection load    forum.hibernate.org

Hi Guys, Really odd one here. I have an object called POF that contains a List collections called lineItems. The constructor of POF initializes lineItems = new ArrayList(0); I have 1 POF in my database with 1 LineItem object persisted in its collection. When I am loading the POF out, when I print the size of the collection, there is a ...

6. composite-element load probem.    forum.hibernate.org

Hello, I have the following mappings for a composite-element as a list. When I read the Parent class, the children (lineItems) get loaded. But the attribues for the key column (orderid) and the index column (linenum) do not get ...

7. Loading NULL elements in Parent/Child relation    forum.hibernate.org

8. Lazy loading a map of composite elements    forum.hibernate.org

I have a problem with maps of composite elements that don't want to work with lazy loading. I mean they always eagerly load the elements. As here the elements are file attachements, you might imagine this quickely leads to memory issues. I didn't find anywhere that maps of composite elements couldn't use lazy loading, but still it seams to be the ...





10. Filtering collection elements when loading    forum.hibernate.org

Hi, Is there a way to filter the child objects when a collection is loaded? For example, instead of deleting objects from a database, we mark them with a "Deleted" flag. Of course, there is no way for Hibernate to know about this, so all child objects (active and deleted) are included in collections. How can I prevent specific objects from ...

11. Avoid loading a big collection when adding elements to it    forum.hibernate.org

Hi, I use Hibernate 3.2.1ga. I have a relationship one-to-many from Account to Transaction, where the number of transactions per account could be very big. I have mapped this as a Set as follows: ... primary key here ... In some cases I need to add a new Transaction to the ...

12. contained elements not loaded    forum.hibernate.org

hi all! somehow, hibernate doesnt load the contained objects of the requested object. im loading a modulefolder, but the contained module is not loaded along with it.(see mapping) why is that? important parts of mapping below, full mapping file available here: http://donhofer.net/mirror/hibernate/hibernate.hbm.xml Ta, chris Hibernate version: 3 Mapping documents: Code: ...

14. Child element is not loaded    forum.hibernate.org

Hi Guys, I have Worker object which has child object State. State is a reference table (hence mutable="false" in the mapping file). Now when I want to create Worker, I am doing something like this Worker worker = new Worker() State state = new State(); state.setId(1); worker.setState(state ); and then das.saveOrUpdate(worker); But when I print any value of State other than ...