• Hari Krishna SAG
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

I've been running through the following Database.com Java SDK quickstart

 

http://forcedotcom.github.com/java-sdk/quick-start <-- The Hello Cloud example

 

To extend the application, I generated a POJO for the Task object, which is basically the following

 

package org.docsample.model;

import javax.persistence.*;
import com.force.sdk.*;

@javax.annotation.Generated(value="com.force.sdk.codegen.ForceJPAClassGenerator")
@Table(name="Task")
@Entity(name="Task")
@com.force.sdk.jpa.annotation.CustomObject(readOnlySchema=true)
public class Task extends com.force.sdk.jpa.model.BaseForceObject {

    public static final String KEY_PREFIX = "00T";


    // whoId possible references:
    // Contact
    // Lead
    protected String whoId;
    // whatId possible references:
    // Account
    // Asset
    // Campaign
    // Case
    // Contract
    // Opportunity
    // Product2
    // Solution
    protected String whatId;
    protected boolean subject;
    protected java.util.Date activityDate;
    protected String status;
    protected String priority;
    //protected User owner;
    protected String description;
    protected boolean isDeleted;
    //protected Account account;
    protected boolean isClosed;
    protected java.util.Calendar createdDate;
    //protected User createdBy;
    protected java.util.Calendar lastModifiedDate;
    //protected User lastModifiedBy;
    protected java.util.Calendar systemModstamp;
    protected boolean isArchived;
    protected int callDurationInSeconds;
    protected CallTypeEnum callType;
    protected String callDisposition;
    protected String callObject;
    protected java.util.Calendar reminderDateTime;
    protected boolean isReminderSet;
    protected Task recurrenceActivityId;
    protected boolean isRecurrence;
    protected java.util.Date recurrenceStartDateOnly;
    protected java.util.Date recurrenceEndDateOnly;
    protected RecurrenceTimeZoneSidKeyEnum recurrenceTimeZoneSidKey;
    protected RecurrenceTypeEnum recurrenceType;
    protected int recurrenceInterval;
    protected int recurrenceDayOfWeekMask;
    protected int recurrenceDayOfMonth;
    protected RecurrenceInstanceEnum recurrenceInstance;
    protected RecurrenceMonthOfYearEnum recurrenceMonthOfYear;
    
...

}

 I am currently trying to add this object, but its not uploading properly. I get the following exception:

 

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.docsample.service.EntityService org.docsample.controller.EntityController.entityService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityService': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [app-context.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: Explicit persistence provider error(s) occurred for "forceDatabase" after trying the following discovered implementations: org.datanucleus.jpa.PersistenceProviderImpl, com.force.sdk.jpa.PersistenceProviderImpl from provider: com.force.sdk.jpa.PersistenceProviderImpl
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
When I take off the following annotation from the entity
@Entity(name="Task")

@Table(name="Task")

It generates a custom object, but with it I get the exceptions above. I can't see the correlation between setting up a standard object in the JPA and BeanGeneration not working. 

 

The settings on the hellocloud app are exactly the same as the demo. The app is working, its just when I add the Task POJO to the Model Bean generation fails. Am I missing a setting somewhere?