collection « DAO « JPA Q&A

1. Avoid having a huge collection of ids by calling a DAO.getAll()

Instead of returning a List<Long> of ids when calling PersonDao.getAll() we wanted not to have an entire collection of ids in memory. Seems like returning a and iterate over this rowset ...

2. how to test persisting entity with not nullable collection

I'm learning how to write test cases and I've encounter a problem. I have a persistence unit with entityA that has not empty collection of Bs. The application workflow ensures that ...

3. How do you represent collections of Hibernate objects in a single POJO?

Consider the following Hibernate mappings:

<hibernate-mapping package="org.example">
  <class name="Customer" table="CUSTOMER">
    <id name="customerId" column="customer_id"/>

    <bag name="itineraries" table="ITINERARY" inverse="true" cascade="all">
      <key column="customer_id"/>

4. Please help with one-to-many DAO collection error

Please help ! Hibernate Version: 2.1.6 Trying to get going with Spring and Hibernate using DAOs and having a heck of a time. Please help me figure this out. One project has many project Logs... But as you'll see below, the collection is giving me problems. Here are my mapping files that describe the relationship.. ---------Project.hbm.xml contains: