Remoting - Callback method not being called
mcrandall Feb 1, 2008 9:10 AMI'm a newbie to the SEAM framework so please be patient with me.
I have successfully used the remoting (AJAX) feature. However, when I have an entity bean (generated by seam gen) that has join columns, the results are returned but the callback method does not get called. Is there something wrong with how I am handling the result set in my component?
Here is my entity bean:
@Entity
@Table(name = "playbackevent")
public class Playbackevent implements java.io.Serializable {
 private String playbackEventId;
 private Transaction transaction;
 private Enduser enduser;
 private Applicationversion applicationversion;
 private Date eventTime;
 private String eventType;
 private String image;
 private String machineId;
 private String machineName;
 public Playbackevent() {
 }
 public Playbackevent(String playbackEventId, Date eventTime, String image) {
 this.playbackEventId = playbackEventId;
 this.eventTime = eventTime;
 this.image = image;
 }
 public Playbackevent(String playbackEventId, Transaction transaction,
 Enduser enduser, Applicationversion applicationversion,
 Date eventTime, String eventType, String image, String machineId,
 String machineName) {
 this.playbackEventId = playbackEventId;
 this.transaction = transaction;
 this.enduser = enduser;
 this.applicationversion = applicationversion;
 this.eventTime = eventTime;
 this.eventType = eventType;
 this.image = image;
 this.machineId = machineId;
 this.machineName = machineName;
 }
 @Id
 @Column(name = "PlaybackEventID", unique = true, nullable = false, length = 32)
 @NotNull
 @Length(max = 32)
 public String getPlaybackEventId() {
 return this.playbackEventId;
 }
 public void setPlaybackEventId(String playbackEventId) {
 this.playbackEventId = playbackEventId;
 }
 @ManyToOne(fetch = FetchType.LAZY)
 @JoinColumn(name = "TransactionID")
 public Transaction getTransaction() {
 return this.transaction;
 }
 public void setTransaction(Transaction transaction) {
 this.transaction = transaction;
 }
 @ManyToOne(fetch = FetchType.LAZY)
 @JoinColumn(name = "EndUserID")
 public Enduser getEnduser() {
 return this.enduser;
 }
 public void setEnduser(Enduser enduser) {
 this.enduser = enduser;
 }
 @ManyToOne(fetch = FetchType.LAZY)
 @JoinColumn(name = "ApplicationVersionID")
 public Applicationversion getApplicationversion() {
 return this.applicationversion;
 }
 public void setApplicationversion(Applicationversion applicationversion) {
 this.applicationversion = applicationversion;
 }
 @Temporal(TemporalType.TIMESTAMP)
 @Column(name = "EventTime", nullable = false, length = 0)
 @NotNull
 public Date getEventTime() {
 return this.eventTime;
 }
 public void setEventTime(Date eventTime) {
 this.eventTime = eventTime;
 }
 @Column(name = "EventType", length = 13)
 @Length(max = 13)
 public String getEventType() {
 return this.eventType;
 }
 public void setEventType(String eventType) {
 this.eventType = eventType;
 }
 @Column(name = "Image", nullable = false, length = 1000)
 @NotNull
 @Length(max = 1000)
 public String getImage() {
 return this.image;
 }
 public void setImage(String image) {
 this.image = image;
 }
 @Column(name = "MachineID", length = 32)
 @Length(max = 32)
 public String getMachineId() {
 return this.machineId;
 }
 public void setMachineId(String machineId) {
 this.machineId = machineId;
 }
 @Column(name = "MachineName", length = 500)
 @Length(max = 500)
 public String getMachineName() {
 return this.machineName;
 }
 public void setMachineName(String machineName) {
 this.machineName = machineName;
 }
}
Here is my component:
@Stateful
@Name("playerAction")
public class PlayerAction implements Player{
 @In EntityManager entityManager;
 private List<Playbackevent> events;
public List<Playbackevent> displayEvents() {
 List playbackEvents = entityManager.createQuery(
 "from Playbackevent p")
 .getResultList();
 events = new ArrayList<Playbackevent>();
 for (int i = 0; i < playbackEvents.size(); i++) {
 Playbackevent bean = (Playbackevent) playbackEvents.get(i);
 events.add(bean);
 }
 return events;
 }
 @Destroy @Remove
 public void destroy() { }
}
Here is the interface:
@Local
public interface Player {
 @WebRemote
 public List<Playbackevent> displayEvents();
 public void destroy();
}My XHTML page:
<s:remote include="playerAction"/>
<script type="text/javascript">
//<![CDATA[
Seam.Remoting.setDebug(true);
var playAction = Seam.Component.getInstance("playerAction");
function displayEvents() {
 playAction.displayEvents(displayEventCallback);
}
function displayEventCallback (result) {
 if (result) {
 var eTable = document.getElementById("eventTable");
 for (i=0;i<result.length;i++){
 var row = eTable.insertRow(0);
 var cell = row.insertCell(0);
 var eventId = result.getImage();
 cell.innerHTML = eventId;
 }
 } else {
 alert("No results.");
 }
 }
 // ]]>
 </script>
 <table id="eventTable">
 </table>
Any help is greatly appreciated.
 
    