You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@olingo.apache.org by "M. Ali Khemila" <mk...@icloud.com> on 2016/10/08 16:14:23 UTC

pojogen-maven-plugin

Hi,

Is anybody familiar with the pojogen-maven-plugin? I can’t find any supporting documentation.

I was able to use the plugin to generate the Java code and run the following example to display my customers list

public class Example {
	
	private static final String SERVICE_ROOT="http://services.odata.org/V4/Northwind/Northwind.svc";

	public static void main(String args[]) {

		Service<EdmEnabledODataClient> service = Service.getV4(SERVICE_ROOT);
		NorthwindEntities container = service.getEntityContainer(NorthwindEntities.class);
		Customers customers = container.getCustomers();
		for (Customer c : customers) {
			System.out.println(c.getCustomerID() + " - " + c.getCompanyName());
			
		}
	}
}


These are the questions I have:
1/ Is customers list found lazily? Obviously, when I call 'container.getCustomers();’ I don’t want all the customers to be loaded at once.
2/ How can I update the name of a specific customer. I tried this:
c.setCustomerName(“NewName”);
container.flush();

And I got the exception below. Please help if you have an idea!!! Many thanks!!

Exception in thread "main" java.lang.NullPointerException
	at org.apache.olingo.ext.proxy.utils.CoreUtils.getODataEntityProperty(CoreUtils.java:153)
	at org.apache.olingo.ext.proxy.utils.CoreUtils.addProperties(CoreUtils.java:294)
	at org.apache.olingo.ext.proxy.commons.AbstractPersistenceManager.processEntityContext(AbstractPersistenceManager.java:157)
	at org.apache.olingo.ext.proxy.commons.AbstractPersistenceManager.flush(AbstractPersistenceManager.java:99)
	at org.apache.olingo.ext.proxy.commons.TransactionalPersistenceManagerImpl.flush(TransactionalPersistenceManagerImpl.java:49)
	at org.apache.olingo.ext.proxy.commons.EntityContainerInvocationHandler.invoke(EntityContainerInvocationHandler.java:86)
	at com.sun.proxy.$Proxy3.flush(Unknown Source)
	at com.icloud.mkhemila.olingo.test.Example.main(Example.java:29)