cancel
Showing results for 
Search instead for 
Did you mean: 

Spring MVC Integration for Java Beans Connectivity (CR)

Former Member
0 Kudos

I have to integrate my Java Spring MVC project with Crystal Reports using POJO. In order to accomplish this, CR requires you to return a ResultSet class along with your bean.

It works when returning a statically assigned collection to ResultSet. Plain and simple. However, I'm running into problems when I try to add DB connectivity via database expert > java beans connectivity returns "failed to retrieve data from the database"

My project has 5 layers -

view

controller -- fetch data and stream PDF to session

service -- get

dao

domain

Steps-

  1. Manually add to classpath all supporting class files (all folders in 5 layer structure) and jars (everything in lib) associated with project in crconfig.xml
  2. Create a Crystal Reports service method which calls the DAO to return a collection of objects and returns a ResultSet
  3. Export jar of service and domain class
  4. run Crystal Reports Designer 2013 and go to java beans connectivity..
  5. add ResultSet method
  6. "failed to retrieve data from the database"

Does anyone know if this support dependency injection? Or anyone have any luck getting this to work?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

code example

@Service

public class PersonReportServiceImpl implements PersonReportService {

  @Autowired

  PersonService personService;

  @Override

  public ResultSet getPerson(Long personId) {

  List<Person> personList = new ArrayList<Person>();

  //calls existing service

  personList = personService.getPerson(personId);

  POJOResultSetFactory factory = new POJOResultSetFactory(

  Person.class);

  POJOResultSet resultSet = factory.createResultSet(personList);

  return personList;

  }

}