- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我会尽量提供详细信息。
我正在使用 Flex(Cairngorm 2)/Java/Hibernate 创建 CRM 应用程序。我遇到的基本问题是:
我在 Java 中有一个 Customer 类,它有一个 Address 类的 ArrayList。我在 Flex 中有一个 Customer 类,它有一个 ArrayCollection of Address 类。
当我为客户调用远程对象时,我在 Flex 中取回了一个客户对象,但是 ArrayCollecion 对象的数据类型是对象而不是地址。
如果我尝试调用地址类列表,我会得到相同的结果。如果我尝试调用客户类列表,我会在 Flex 中获得客户类列表。
将 tomcat 6 与以下 jar 一起使用:
antlr-2.7.6.jar
flex-messaging-proxy.jar
backport-util-concurrent.jar
flex-messaging-remoting.jar
cfgatewayadapter.jar
hibernate3.jar
commons-codec-1.3.jar
hibernate-jpa-2.0-api-1.0.0.Final.jar
commons-collections-3.1.jar
javassist-3.12.0.GA.jar
commons-httpclient-3.0.1.jar
jta-1.1.jar
commons-logging.jar
logback-classic-0.9.28.jar
concurrent.jar
logback-core-0.9.28.jar
dom4j-1.6.1.jar
mybatis-3.0.4.jar
flex-messaging-common.jar
mysql-connector-java-5.1.16-bin.jar
flex-messaging-core.jar
slf4j-api-1.6.1.jar
flex-messaging-opt.jar
xalan.jar
客户作为
package com.middleburgsalesandservice.gryphon.vo.customer
{
import com.middleburgsalesandservice.gryphon.vo.common.AttributeCollection;
import mx.collections.ArrayCollection;
[Bindable]
[RemoteClass(alias="com.middleburgsalesandservice.gryphon.pojo.customer.Customer")]
public class Customer
{
public var customerId:int;
public var startDate:Date = new Date();
public var endDate:Date = new Date();
public var createdDate:Date = new Date();
public var customerFirstName:String;
public var customerLastName:String;
public var customerUserName:String;
public var customerPassWord:String;
public var addresses:ArrayCollection = new ArrayCollection();
public var phones:ArrayCollection = new ArrayCollection();
public var customerOrders:ArrayCollection = new ArrayCollection();
public var webSites:ArrayCollection = new ArrayCollection();
public var emails:ArrayCollection = new ArrayCollection();
public var attributes:ArrayCollection = new ArrayCollection();
public var attributeCollection:AttributeCollection = new AttributeCollection();
public function Customer()
{
super();
}
}
地址.as
package com.middleburgsalesandservice.gryphon.vo.common
{
[Bindable]
[RemoteClass(alias="com.middleburgsalesandservice.gryphon.pojo.common.Address")]
public class Address
{
public var addressId:int;
public var address1:String;
public var address2:String;
public var city:String;
public var state:State = new State();
public var zipCode:String;
public var addressType:AddressType = new AddressType();
public var country:Country = new Country();
public var primaryNumber:int;
public var primaryAddress:Boolean;
public var startDate:Date;
public var endDate:Date;
public function Address()
{
super();
}
}
客户.java
package com.middleburgsalesandservice.gryphon.pojo.customer;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.middleburgsalesandservice.gryphon.pojo.common.Address;
import com.middleburgsalesandservice.gryphon.pojo.common.Attribute;
import com.middleburgsalesandservice.gryphon.pojo.common.AttributeCollection;
import com.middleburgsalesandservice.gryphon.pojo.common.EmailAddress;
import com.middleburgsalesandservice.gryphon.pojo.common.Phone;
import com.middleburgsalesandservice.gryphon.pojo.common.WebAddress;
import com.middleburgsalesandservice.gryphon.pojo.order.Order;
public class Customer {
private int customerId;
private Date startDate;
private Date endDate;
private String customerFirstName;
private String customerLastName;
private Date createdDate;
private String customerUserName;
private String customerPassWord;
private List<Address> addresses = new ArrayList<Address>();
private List<Phone> phones = new ArrayList<Phone>();
private List<Order> customerOrders = new ArrayList<Order>();
private List<WebAddress> webSites = new ArrayList<WebAddress>();
private List<EmailAddress> emails = new ArrayList<EmailAddress>();
private List<Attribute> attributes = new ArrayList<Attribute>();
private AttributeCollection attributeCollection;
public String getCustomerFirstName() {
return customerFirstName;
}
public void setCustomerFirstName(String customerFirstName) {
this.customerFirstName = customerFirstName;
}
public String getCustomerLastName() {
return customerLastName;
}
public void setCustomerLastName(String customerLastName) {
this.customerLastName = customerLastName;
}
public String getCustomerUserName() {
return customerUserName;
}
public void setCustomerUserName(String customerUserName) {
this.customerUserName = customerUserName;
}
public String getCustomerPassWord() {
return customerPassWord;
}
public void setCustomerPassWord(String customerPassWord) {
this.customerPassWord = customerPassWord;
}
public List<Address> getAddresses() {
return addresses;
}
public void setAddresses(List<Address> addresses) {
this.addresses = addresses;
}
public List<Phone> getPhones() {
return phones;
}
public void setPhones(List<Phone> phones) {
this.phones = phones;
}
public String getFullName(){
return this.getCustomerFirstName() + " " + this.getCustomerLastName();
}
/**
* @return the createdDate
*/
public Date getCreatedDate() {
return createdDate;
}
/**
* @param createdDate the createdDate to set
*/
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
/**
* @return the customerOrders
*/
public List<Order> getCustomerOrders() {
return customerOrders;
}
/**
* @param customerOrders the customerOrders to set
*/
public void setCustomerOrders(List<Order> customerOrders) {
this.customerOrders = customerOrders;
}
/**
* @return the webSites
*/
public List<WebAddress> getWebSites() {
return webSites;
}
/**
* @param webSites the webSites to set
*/
public void setWebSites(List<WebAddress> webSites) {
this.webSites = webSites;
}
/**
* @return the emails
*/
public List<EmailAddress> getEmails() {
return emails;
}
/**
* @param emails the emails to set
*/
public void setEmails(List<EmailAddress> emails) {
this.emails = emails;
}
/**
* @return the attributeCollection
*/
public AttributeCollection getAttributeCollection() {
return attributeCollection;
}
/**
* @param attributeCollection the attributeCollection to set
*/
public void setAttributeCollection(AttributeCollection attributeCollection) {
this.attributeCollection = attributeCollection;
}
/**
* @return the attributes
*/
public List<Attribute> getAttributes() {
return attributes;
}
/**
* @param attributes the attributes to set
*/
public void setAttributes(List<Attribute> attributes) {
this.attributes = attributes;
}
/**
* @return the customerId
*/
public int getCustomerId() {
return customerId;
}
/**
* @param customerId the customerId to set
*/
public void setCustomerId(int customerId) {
this.customerId = customerId;
}
/**
* @return the startDate
*/
public Date getStartDate() {
return startDate;
}
/**
* @param startDate the startDate to set
*/
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
/**
* @return the endDate
*/
public Date getEndDate() {
return endDate;
}
/**
* @param endDate the endDate to set
*/
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "ID=" + this.getCustomerId() + "|FirstName=" + this.getCustomerFirstName() + "|LastName=" + this.getCustomerLastName();
}
地址.java
package com.middleburgsalesandservice.gryphon.pojo.common;
import java.util.Date;
public class Address {
private int addressId;
private Date startDate;
private Date endDate;
private String address1;
private String address2;
private String city;
private State state;
private String zipCode;
private AddressType addressType;
private Country country;
private boolean primaryAddress;
public Country getCountry() {
return country;
}
public void setCountry(Country country) {
this.country = country;
}
public AddressType getAddressType() {
return addressType;
}
public void setAddressType(AddressType addressType) {
this.addressType = addressType;
}
public String getAddress1() {
return address1;
}
public void setAddress1(String address1) {
this.address1 = address1;
}
public String getAddress2() {
return address2;
}
public void setAddress2(String address2) {
this.address2 = address2;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public State getState() {
return state;
}
public void setState(State state) {
this.state = state;
}
public String getZipCode() {
return zipCode;
}
public void setZipCode(String zipCode) {
this.zipCode = zipCode;
}
/**
* @return the primaryAddress
*/
public boolean isPrimaryAddress() {
return primaryAddress;
}
/**
* @param primaryAddress the primaryAddress to set
*/
public void setPrimaryAddress(boolean primaryAddress) {
this.primaryAddress = primaryAddress;
}
/**
* @return the addressId
*/
public int getAddressId() {
return addressId;
}
/**
* @param addressId the addressId to set
*/
public void setAddressId(int addressId) {
this.addressId = addressId;
}
/**
* @return the endDate
*/
public Date getEndDate() {
return endDate;
}
/**
* @param endDate the endDate to set
*/
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
/**
* @return the startDate
*/
public Date getStartDate() {
return startDate;
}
/**
* @param startDate the startDate to set
*/
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
}
hibernate 映射:客户.hbm.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.middleburgsalesandservice.gryphon.pojo.customer.Customer" table="customer">
<id column="customer_id" name="customerId" type="int">
<generator class="native"/>
</id>
<property column="cust_f_name" name="customerFirstName" />
<property column="cust_l_name" name="customerLastName" />
<property column="cust_user_name" name="customerUserName" />
<property column="cust_pass_word" name="customerPassWord" />
<property column="startdate" name="startDate" type="java.util.Date"/>
<property column="enddate" name="endDate" type="java.util.Date"/>
<property column="created_dt" name="createdDate" type="java.util.Date"/>
<many-to-one column="attribute_col_id" name="attributeCollection" class="com.middleburgsalesandservice.gryphon.pojo.common.AttributeCollection"/>
<bag name="addresses" table="cust_address" lazy="false">
<key column="customer_id"/>
<many-to-many column="address_id" class="com.middleburgsalesandservice.gryphon.pojo.common.Address"/>
</bag>
<bag name="phones" table="cust_phone" lazy="false">
<key column="customer_id"/>
<many-to-many column="phone_id" class="com.middleburgsalesandservice.gryphon.pojo.common.Phone"/>
</bag>
<bag name="webSites" table="cust_web_address" lazy="false">
<key column="customer_id"/>
<many-to-many column="web_address_id" class="com.middleburgsalesandservice.gryphon.pojo.common.WebAddress"/>
</bag>
<bag name="emails" table="cust_email" lazy="false">
<key column="customer_id"/>
<many-to-many column="email_id" class="com.middleburgsalesandservice.gryphon.pojo.common.EmailAddress"/>
</bag>
<bag name="attributes" table="cust_attributes" lazy="false">
<key column="customer_id"/>
<many-to-many column="attribute_id" class="com.middleburgsalesandservice.gryphon.pojo.common.Attribute"/>
</bag>
<bag name="customerOrders" table="customer_orders" lazy="false">
<key column="customer_id"/>
<many-to-many column="order_id" class="com.middleburgsalesandservice.gryphon.pojo.order.Order"/>
</bag>
</class>
</hibernate-mapping>
地址.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.middleburgsalesandservice.gryphon.pojo.common.Address" table="address">
<id column="address_id" name="addressId" type="int">
<generator class="native"/>
</id>
<property column="startdate" name="startDate" type="java.util.Date"/>
<property column="enddate" name="endDate" type="java.util.Date"/>
<property column ="addr1" name="address1" />
<property column ="addr2" name="address2" />
<property column="city" name="city" />
<property column="zip_code" name="zipCode" />
<many-to-one column="state_id" name="state" class="com.middleburgsalesandservice.gryphon.pojo.common.State" />
<many-to-one column="address_type_id" name="addressType" class="com.middleburgsalesandservice.gryphon.pojo.common.AddressType" />
<many-to-one column="country_id" name="country" class="com.middleburgsalesandservice.gryphon.pojo.common.Country" />
<property column="primary_address" name="primaryAddress" type="java.lang.Boolean" />
</class>
</hibernate-mapping>
最佳答案
您应该在 SWF 中的某处引用您的 Address
类。最好的方法是在主应用程序中声明一个字段:
private var references:Object = {addressClass:Address, someOtheClass:SomeOtherClass};
问题是 ActionScript 中的 ArrayCollection
没有类型引用(Java 中的泛型)。所以类的字节码不包含在 SWF 中。
关于java - 为什么 Java 值对象作为 Generic Flex 对象返回?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6944025/
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
在编码时,我问了自己这个问题: 这样更快吗: if(false) return true; else return false; 比这个? if(false) return true; return
如何在逻辑条件下进行“返回”? 在这样的情况下这会很有用 checkConfig() || return false; var iNeedThis=doSomething() || return fa
这是我的正则表达式 demo 如问题所述: 如果第一个数字是 1 则返回 1 但如果是 145 则返回 145 但如果是 133 则返回 133 样本数据a: K'8134567 K'81345678
在代码高尔夫问答部分查看谜题和答案时,我遇到了 this solution返回 1 的最长和最晦涩的方法 引用答案, int foo(void) { return! 0; } int bar(
我想在下面返回 JSON。 { "name": "jackie" } postman 给我错误。说明 Unexpected 'n' 这里是 Spring Boot 的新手。 1日龄。有没有正确的方法来
只要“is”返回 True,“==”不应该返回 True 吗? In [101]: np.NAN is np.nan is np.NaN Out[101]: True In [102]: np.NAN
我需要获取所有在 6 号或 7 号房间或根本不在任何房间的学生的详细信息。如果他们在其他房间,简单地说,我不希望有那个记录。 我的架构是: students(roll_no, name,class,.
我有一个表单,我将它发送到 php 以通过 ajax 插入到 mysql 数据库中。一切顺利,php 返回 "true" 值,但在 ajax 中它显示 false 消息。 在这里你可以查看php代码:
我在 Kotlin 中遇到了一个非常奇怪的无法解释的值比较问题,以下代码打印 假 data class Foo ( val a: Byte ) fun main() { val NUM
请注意,这并非特定于 Protractor。问题在于 Angular 2 的内置 Testability service Protractor 碰巧使用。 Protractor 调用 Testabil
在调试窗口中,以下表达式均返回 1。 Application.WorksheetFunction.CountA(Cells(4 + (i - 1) * rows_per_record, 28) & "
我在本地使用 jsonplaceholder ( http://jsonplaceholder.typicode.com/)。我正在通过 extjs rest 代理测试我的 GET 和 POST 调用
这是 Postman 为成功调用我的页面而提供的(修改后的)代码段。 var client = new RestClient("http://sub.example.com/wp-json/wp/v2
这个问题在这里已经有了答案: What to do with mysqli problems? Errors like mysqli_fetch_array(): Argument #1 must
我想我对 C 命令行参数有点生疏。我查看了我的一些旧代码,但无论这个版本是什么,都会出现段错误。 运行方式是 ./foo -n num(其中 num 是用户在命令行中输入的数字) 但不知何故它不起作用
我已经编写了一个类来处理命名管道连接,如果我创建了一个实例,关闭它,然后尝试创建另一个实例,调用 CreateFile() 返回 INVALID_HANDLE_VALUE,并且 GetLastErro
即使 is_writable() 返回 true,我也无法写入文件。当然,该文件存在并且显然是可读的。这是代码: $file = "data"; echo file_get_contents($fil
下面代码中的变量 $response 为 NULL,尽管它应该是 SOAP 请求的值。 (潮汐列表)。当我调用 $client->__getLastResponse() 时,我从 SOAP 服务获得了
我一直在网上的不同论坛上搜索答案,但似乎没有与我的情况相符的... 我正在使用 Windows 7,VS2010。 我有一个使用定时器来调用任务栏刷新功能的应用程序。在该任务栏函数中包含对 LoadI
我是一名优秀的程序员,十分优秀!