cancel
Showing results for 
Search instead for 
Did you mean: 

Bean Model Interaction

Former Member
0 Kudos

Hi,

the following problem has been bugging me four hours:

I have a customer entity with an embedded primary key like this:


@Entity
@Table
public class Customer implements Serializable
{
	private static final long serialVersionUID = 1L;

	@EmbeddedId
	private Customer.PK pk;

	@Column(name = "CUST_CITY")
	private String custCity;

    [...]

	public Customer.PK getPk()
	{
		return this.pk;
	}

	public void setPk(Customer.PK pk)
	{
		this.pk = pk;
	}

    [...]

	@Embeddable
	public static class PK implements Serializable
	{
		@GeneratedValue
		@Column(name = "CUST_ID")
		private long custId;

		@Column(name = "CUST_VALIDFROM")
		private Date custValidFrom;

		private static final long serialVersionUID = 1L;

		public PK()
		{
			super();
		}

		public long getCustId()
		{
			return this.custId;
		}

		public void setCustId(long custId)
		{
			this.custId = custId;
		}

        [...]
	}
}

A CustomerFacade presents methods like insert, update and find to my view layer, where it's imported as an enterpise bean model.

signature for the find method:


	Collection<Customer> find(parameter1, parameter2, ...)

signature for the insert method:


	void insert(Customer customer)

The find method works like a charm (i get the customer data including the primary key, see <a href="http://www.flickr.com/photos/15138041@N00/1380832666/">picture 1</a>).

When I try to insert a customer I fill the context node for the customer and the context node for the pk, but when I inspect the customer parameter in the insert function, pk is always null (all other fields are filled as desired, see <a href="http://www.flickr.com/photos/15138041@N00/1379938593/">picture 2</a>)

the code for filling the insert context node:


	IInsertCustomerElement custInsertElem = wdContext.nodeInsertCustomer().currentInsertCustomerElement();
	
	WDCopyService.copyCorresponding(custEditElem, custInsertElem);

	if (wdContext.nodeInsertPk().size() == 0) {
		wdContext.nodeInsertPk().createAndAddInsertPkElement();
	}
	
	IInsertPkElement custInsertPkElem = wdContext.nodeInsertPk().currentInsertPkElement();


	custInsertPkElem.setCustId(custEditElem.getCustId());
	custInsertPkElem.setCustValidfrom(custEditElem.getCustValidfrom());

	wdContext.currentRequest_CustomerFacadeLocal_insertElement().modelObject().execute();

in my logfiles i see a very supicous entry:


#1.5 #0017310D6D2D001E0000009300000C3401B2B1ADD1D14988#1189762973953#com.sap.tc.webdynpro.model.ejb.model.EJBGenericModelClassExecutable#mycompany.com/myapp~cust01wd#com.sap.tc.webdynpro.model.ejb.model.EJBGenericModelClassExecutable.constructBeanFromModelClass#Guest#121####ddcc771062a611dcb6ea0017310d6d2d#HTTP Worker [2]##0#0#Error##Plain###Cannot create Object from NULL#

but i still have no clue what goes wrong.

regards,

christian

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

any hints on this topic?