Thursday, February 15, 2007

TopLink and Dali at EclipseCon 2007

EclipseCon runs from March 5th to 8th this year and I'm involved with a number of sessions relating to Dali and TopLink. If you'll be there I hope you'll consider checking them out.

The first is a short tutorial on Dali on Monday at 10:30. Neil Hauge, my co-lead on Dali will be co-presenting. It'll involve some hands on so bring a laptop. The tutorial number and title is (3633) Building applications with WTP - Java Persistence API (JPA).

If you can't make the tutorial but want to find out more about Dali, Neil and I will be giving the demo session the Dali Java Persistence API Tools Project on Wednesday at 14:30.

On a non-Dali topic, I'll be co-presenting with Stephan Eberle of Bosch a demo session entitled Integrating EMF with JPA--Enabling Enterprise Data Access for RCP Applications where we'll describe and demo the results of our collaboration. That's scheduled for Wednesday at 16:30.

Hope to see you there!

--Shaun

Monday, February 5, 2007

Read-Only JPA Entities

This came up on the TopLink Forum last week but for those who don't read all the postings I thought I'd repeat the information here.

The question was whether it's possible to have read-only Entities in JPA. This isn't in the spec but is possible in TopLink Essentials. You do it by calling the setReadOnly() method on an Entity's TopLink descriptor. One way to do this is through a descriptor customizer.

For example, in persistence.xml:

<property
  name="toplink.descriptor.customizer.Title"
  value="comics.toplink.TitleCustomizer"/>


And a definition of TitleCustomizer implementing oracle.toplink.essentials.tools.sessionconfiguration.DescriptorCustomizer.

public class TitleCustomizer implements DescriptorCustomizer {

public void customize(ClassDescriptor desc) throws Exception {
desc.setReadOnly();
}
}


The semantics of read-only are that any changes you make to an object will not be written to the database, but you are not prevented from making changes.

--Shaun