master detail problem in seam when integrating with flex using Flamingo
flamingo Feb 14, 2010 2:03 PMHi I am using FlamingoDS to integrate seam with flex
I have an entity called ItCargoPosition and one more entity called IcStorageNameDetail
In ItCargoPosition entity
private IcStorageNameDetail icStorageNameDetailByStorageName;
private IcStorageNameDetail icStorageNameDetailByStorageRow;
private IcStorageNameDetail icStorageNameDetailByStorageColumn;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "STORAGE_NAME", nullable = false)
@NotNull
public IcStorageNameDetail getIcStorageNameDetailByStorageName() {
return this.icStorageNameDetailByStorageName;
}
public void setIcStorageNameDetailByStorageName(
IcStorageNameDetail icStorageNameDetailByStorageName) {
this.icStorageNameDetailByStorageName = icStorageNameDetailByStorageName;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "STORAGE_ROW", nullable = false)
@NotNull
public IcStorageNameDetail getIcStorageNameDetailByStorageRow() {
return this.icStorageNameDetailByStorageRow;
}
public void setIcStorageNameDetailByStorageRow(
IcStorageNameDetail icStorageNameDetailByStorageRow) {
this.icStorageNameDetailByStorageRow = icStorageNameDetailByStorageRow;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "STORAGE_COLUMN", nullable = false)
@NotNull
public IcStorageNameDetail getIcStorageNameDetailByStorageColumn() {
return this.icStorageNameDetailByStorageColumn;
}
public void setIcStorageNameDetailByStorageColumn(
IcStorageNameDetail icStorageNameDetailByStorageColumn) {
this.icStorageNameDetailByStorageColumn = icStorageNameDetailByStorageColumn;
}
and in IcStorageNameDetail I have
private Set<ItCargoPosition> itCargoPositionsForStorageRow = new HashSet<ItCargoPosition>(
0);
private Set<ItCargoPosition> itCargoPositionsForStorageName = new HashSet<ItCargoPosition>(
0);
private Set<ItCargoPosition> itCargoPositionsForStorageColumn = new HashSet<ItCargoPosition>(
0);
@OneToMany(fetch = FetchType.LAZY, mappedBy = "icStorageNameDetailByStorageRow")
public Set<ItCargoPosition> getItCargoPositionsForStorageRow() {
return this.itCargoPositionsForStorageRow;
}
public void setItCargoPositionsForStorageRow(
Set<ItCargoPosition> itCargoPositionsForStorageRow) {
this.itCargoPositionsForStorageRow = itCargoPositionsForStorageRow;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "icStorageNameDetailByStorageName")
public Set<ItCargoPosition> getItCargoPositionsForStorageName() {
return this.itCargoPositionsForStorageName;
}
public void setItCargoPositionsForStorageName(
Set<ItCargoPosition> itCargoPositionsForStorageName) {
this.itCargoPositionsForStorageName = itCargoPositionsForStorageName;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "icStorageNameDetailByStorageColumn")
public Set<ItCargoPosition> getItCargoPositionsForStorageColumn() {
return this.itCargoPositionsForStorageColumn;
}
public void setItCargoPositionsForStorageColumn(
Set<ItCargoPosition> itCargoPositionsForStorageColumn) {
this.itCargoPositionsForStorageColumn = itCargoPositionsForStorageColumn;
}
the above are my entities
and I have a created my own component to retrieve the details from the database
as follows
package com.infyz.toms.planning;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceContextType;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.log.Log;
import com.infyz.toms.admin.configuration.cargooperations.entity.IcStorageName;
import com.infyz.toms.ordermanagement.exportshipment.entity.ItCargoPosition;
@Name("planservice")
@Stateless
public class PlanSession implements PlanInterface{
@Logger
private Log log;
@PersistenceContext(type=PersistenceContextType.TRANSACTION)
private EntityManager em;
public List<ItCargoPosition> cargoPositionList()
{
return em.createQuery("from ItCargoPosition").getResultList();
}
}
In my mxml I am calling this method to get the values from the database
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="white" width="100%" height="100%" verticalGap="0"
horizontalGap="0" initialize="cc();" creationComplete="service.cargoPositionList();">
<mx:RemoteObject id="service" destination="planservice">
<mx:method name="cargoPositionList" result="resultHandlerName(event);" fault="Alert.show(event.fault.faultString);"/>
</mx:RemoteObject>
private function resultHandlerName(e:ResultEvent):void
{
}
here e.result will contain the return list from my component
the problem here is I am not getting the values for the references to IcStorageNameDetail
and my services-config.xml is
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
<services>
<service
id="plan-service"
class="flex.messaging.services.RemotingService"
messageTypes="flex.messaging.messages.RemotingMessage">
<destination id="planservice">
<default-channels>
<channel ref="seam-amf"/>
</default-channels>
</service>
</services>
<channels>
<channel-definition id="seam-amf" class="mx.messaging.channels.AMFChannel">
<endpoint
uri="http://{server.name}:{server.port}/toms/seam/resource/amf"
class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<add-no-cache-headers>false</add-no-cache-headers>
</properties>
</channel-definition>
</channels>
</services-config>
and I didn't write any .as files corresponding to the entities
please help me
It's creating big pain for me
I have an entity called ItCargoPosition and one more entity called IcStorageNameDetail
In ItCargoPosition entity
private IcStorageNameDetail icStorageNameDetailByStorageName;
private IcStorageNameDetail icStorageNameDetailByStorageRow;
private IcStorageNameDetail icStorageNameDetailByStorageColumn;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "STORAGE_NAME", nullable = false)
@NotNull
public IcStorageNameDetail getIcStorageNameDetailByStorageName() {
return this.icStorageNameDetailByStorageName;
}
public void setIcStorageNameDetailByStorageName(
IcStorageNameDetail icStorageNameDetailByStorageName) {
this.icStorageNameDetailByStorageName = icStorageNameDetailByStorageName;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "STORAGE_ROW", nullable = false)
@NotNull
public IcStorageNameDetail getIcStorageNameDetailByStorageRow() {
return this.icStorageNameDetailByStorageRow;
}
public void setIcStorageNameDetailByStorageRow(
IcStorageNameDetail icStorageNameDetailByStorageRow) {
this.icStorageNameDetailByStorageRow = icStorageNameDetailByStorageRow;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "STORAGE_COLUMN", nullable = false)
@NotNull
public IcStorageNameDetail getIcStorageNameDetailByStorageColumn() {
return this.icStorageNameDetailByStorageColumn;
}
public void setIcStorageNameDetailByStorageColumn(
IcStorageNameDetail icStorageNameDetailByStorageColumn) {
this.icStorageNameDetailByStorageColumn = icStorageNameDetailByStorageColumn;
}
and in IcStorageNameDetail I have
private Set<ItCargoPosition> itCargoPositionsForStorageRow = new HashSet<ItCargoPosition>(
0);
private Set<ItCargoPosition> itCargoPositionsForStorageName = new HashSet<ItCargoPosition>(
0);
private Set<ItCargoPosition> itCargoPositionsForStorageColumn = new HashSet<ItCargoPosition>(
0);
@OneToMany(fetch = FetchType.LAZY, mappedBy = "icStorageNameDetailByStorageRow")
public Set<ItCargoPosition> getItCargoPositionsForStorageRow() {
return this.itCargoPositionsForStorageRow;
}
public void setItCargoPositionsForStorageRow(
Set<ItCargoPosition> itCargoPositionsForStorageRow) {
this.itCargoPositionsForStorageRow = itCargoPositionsForStorageRow;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "icStorageNameDetailByStorageName")
public Set<ItCargoPosition> getItCargoPositionsForStorageName() {
return this.itCargoPositionsForStorageName;
}
public void setItCargoPositionsForStorageName(
Set<ItCargoPosition> itCargoPositionsForStorageName) {
this.itCargoPositionsForStorageName = itCargoPositionsForStorageName;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "icStorageNameDetailByStorageColumn")
public Set<ItCargoPosition> getItCargoPositionsForStorageColumn() {
return this.itCargoPositionsForStorageColumn;
}
public void setItCargoPositionsForStorageColumn(
Set<ItCargoPosition> itCargoPositionsForStorageColumn) {
this.itCargoPositionsForStorageColumn = itCargoPositionsForStorageColumn;
}
the above are my entities
and I have a created my own component to retrieve the details from the database
as follows
package com.infyz.toms.planning;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceContextType;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.log.Log;
import com.infyz.toms.admin.configuration.cargooperations.entity.IcStorageName;
import com.infyz.toms.ordermanagement.exportshipment.entity.ItCargoPosition;
@Name("planservice")
@Stateless
public class PlanSession implements PlanInterface{
@Logger
private Log log;
@PersistenceContext(type=PersistenceContextType.TRANSACTION)
private EntityManager em;
public List<ItCargoPosition> cargoPositionList()
{
return em.createQuery("from ItCargoPosition").getResultList();
}
}
In my mxml I am calling this method to get the values from the database
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="white" width="100%" height="100%" verticalGap="0"
horizontalGap="0" initialize="cc();" creationComplete="service.cargoPositionList();">
<mx:RemoteObject id="service" destination="planservice">
<mx:method name="cargoPositionList" result="resultHandlerName(event);" fault="Alert.show(event.fault.faultString);"/>
</mx:RemoteObject>
private function resultHandlerName(e:ResultEvent):void
{
}
here e.result will contain the return list from my component
the problem here is I am not getting the values for the references to IcStorageNameDetail
and my services-config.xml is
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
<services>
<service
id="plan-service"
class="flex.messaging.services.RemotingService"
messageTypes="flex.messaging.messages.RemotingMessage">
<destination id="planservice">
<default-channels>
<channel ref="seam-amf"/>
</default-channels>
</service>
</services>
<channels>
<channel-definition id="seam-amf" class="mx.messaging.channels.AMFChannel">
<endpoint
uri="http://{server.name}:{server.port}/toms/seam/resource/amf"
class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<add-no-cache-headers>false</add-no-cache-headers>
</properties>
</channel-definition>
</channels>
</services-config>
and I didn't write any .as files corresponding to the entities
please help me
It's creating big pain for me