Persistence is null

I am working on creating a web service class in the app-core that has the @WebService annotation on it so we can have another webservice call into it. I have everything working great except when I try and use the
protected Persistence persistence;

When trying to use this anywhere in the class the persistence object is null. I was wondering if there was anything I was missing or what I needed to do to the the Persistence accessible and not null.

Hi Alex,
Perhaps your web service class is not a Spring bean and it works by means of JavaEE container provided by your application server. CUBA infrastructure including Persistence is provided by Spring container, so you cannot inject it to your web service class. But you can get it by using static methods of AppBeans class, e.g.:

Persistence persistence = AppBeans.get(Persistence.class);

That worked great. Thanks!