Note that there are some explanatory texts on larger screens.

plurals
  1. POrequestfactory complain about find method
    primarykey
    data
    text
    <p>I have a spring (3.1) application with a service and dao layer. I try to use requestfactory (gwt 2.4) withi this spring layer.</p> <p>Here some of my class</p> <p>My domain class</p> <pre><code>public class Account { Long id; String username; // get, set } </code></pre> <p>The bridge between spring and gwt</p> <pre><code>public class SpringServiceLocator implements ServiceLocator { @Override public Object getInstance(Class&lt;?&gt; clazz) { HttpServletRequest request = RequestFactoryServlet.getThreadLocalRequest(); ServletContext servletContext = request.getSession().getServletContext(); ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext); return context.getBean(clazz); } } </code></pre> <p>My account proxy</p> <pre><code>@ProxyFor(value=Account.class, locator = AccountLocator.class) public interface AccountProxy extends EntityProxy{ public Long getId(); public String getUsername(); public void setUsername(String userName); public void setId(Long id); } </code></pre> <p>RequestContext class</p> <pre><code>@Service(locator = SpringServiceLocator.class, value =AccountService.class) public interface AccountRequest extends RequestContext { Request&lt;List&lt;AccountProxy&gt;&gt; loadAllAccounts(); } </code></pre> <p>My requestFactory class</p> <pre><code>public interface AccountRequestFactory extends RequestFactory { AccountRequest accountRequest(); } </code></pre> <p>My spring service</p> <pre><code>public interface AccountService { public List&lt;Account&gt; loadAllAccounts(); } @Service public class AccountServiceImpl implements AccountService{ @Autowired private AccountDAO accountDAO; } </code></pre> <p>Account locator to avoid to put method in the entity</p> <pre><code>public class AccountLocator extends Locator&lt;Account, Long&gt; { @Autowired private AccountDAO accountDAO; @Override public Account create(Class&lt;? extends Account&gt; clazz) { return new Account(); } } </code></pre> <p>applicationContext.xml</p> <pre><code>&lt;context:annotation-config /&gt; &lt;context:component-scan base-package="com.calibra" /&gt; &lt;bean id="accountService" class="org.calibra.server.service.AccountServiceImpl"/&gt; &lt;bean id="accountDAO" class="org.calibra.server.dao.AccountDAOImpl"/&gt; </code></pre> <p>The demo work but i get this error:</p> <p><em><strong>com.google.web.bindery.requestfactory.server.UnexpectedException: Could not find static method with a single parameter of a key type</em></strong></p> <p>Also on my AccountProxy i get this complain (a warning)</p> <p><em><strong>The domain type org.calibra.domain.Account has no Account findAccount(java.lang.Long) method. Attempting to send a AccountProxy to the server will result in a server error.</em></strong></p> <p>I don't want to add a find methond in my domain class. I tried to put this method in my spring service, but i get the same warning.</p> <p>Edit with the Locator that work fine</p> <p>Just strange i need to put bean in the applicationContext, context:annotation and context:component-scan seem useless</p> <p>Any idea?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload