I need to call static method of org.hibernate.Hibernate class. How to do that in element of flow ?
Asked
Active
Viewed 7,929 times
5
-
Can you elaborate more in detail? – Mohamed Saligh Nov 23 '10 at 10:23
-
@Mohamed Saligh: More details - I have Product entity with list of images, that are lazy initialized. In a flow (on entry some view) i need to initialize images by calling org.hibernate.Hibernate.initialize() static method. How to do that ? – marioosh Nov 23 '10 at 10:35
2 Answers
14
You can use the following Spring EL construct to evaluate static methods:
<evaluate expression="T(org.hibernate.Hibernate).initialize(yourObject)"/>
See the appropriate Spring EL reference part:

Denys Kniazhev-Support Ukraine
- 8,862
- 7
- 47
- 63
0
spring-webflow 2 uses OGNL expressions. OGNL allows for static referencing of fields and methods. To utilize it you would want to use the '@' notations.
First you reference the class (with package). You would want to put an @ before the package and class name and an @ before the method call. With hibernate it would look like
<evaluate expression="@org.hibernate.Hibernate@initialize()"/>

John Vint
- 39,695
- 7
- 78
- 108
-
It doesn't work. I get parse error: org.springframework.expression.spel.SpelParseException: EL1041E:(pos 24): After parsing a valid expression, there is still more data in the expression: 'bean_ref(@)' – marioosh Nov 24 '10 at 07:56