Some info

Falcon has provided functionality to allow binding of JPA generated beans. For now the functionalities cover selects from JPAQL and allow specification of parameters. The value of these parameters can be:
  • static or from other beans
  • generated by falcon (i.e. dtRef)
  • existing objects passed into the engine.
Examples of falcon files can be found under:
                ./src/test\resources\testData\simpleBeanJpa.fal
                ./src/test/resources/testData/simpleBeanJpaWithStaticParam.fal
                ./src/test/resources/testData/simpleBeanJpaWithDtRef.fal
            

Straight JPAQL with no paramters

                
                  <?xml version="1.0" encoding="UTF-8" ?>
                        <falconBind:falcon xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xsi:schemaLocation="www.falcon.com/bindingSchema ../../../main/xsd/falconBind.xsd"
                        xmlns:falconBind="www.falcon.com/bindingSchema" id="testId">
                        <falconBind:binding>
                            <falconBind:dataTransfer
                                    classObject="com.falcon.mock.testObjects.EmpJpa" name="testJpaPojo"
                                    type="JPA">
                                <falconBind:ObjectStory>
                                    <falconBind:JPA persistence-unit_name="example" query="select e from EmpJpa e" return_as_list="true"/>
                                </falconBind:ObjectStory>
                            </falconBind:dataTransfer>
                        </falconBind:binding>
                    </falconBind:falcon>
                  
            
The noticeable change here from a pojo definition are:
  • 'type' attribute of 'dataTransfer' tag is now 'JPA' rather then 'pojo'.
  • new tag 'ObjectStory' and its related 'JPA' tag is used to specify JPA settings
  • 'retrun_as_list' attribute can be 'true' or 'false' depending on how you want want your object(s) back.

getting your JPA objects from Falcon

There is no special syntax for doing that is the same as getting back pojos! Note only 1 line of code is required to get your JPA object(s) back!!! ;) As List:
                    List empList = (List) runner.getObject("testJpaPojo");
                
As Single Object (when 'return_as_list' is set to 'false'):
                    EmpJpa emp = (EmpJpa) runner.getObject("testJpaPojo");