5

I need to call static method of org.hibernate.Hibernate class. How to do that in element of flow ?

skaffman
  • 398,947
  • 96
  • 818
  • 769
marioosh
  • 27,328
  • 49
  • 143
  • 192
  • 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 Answers2

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:

http://static.springsource.org/spring/docs/3.2.x/spring-framework-reference/html/expressions.html#expressions-types

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