View Full Version : Error: Unknown Property: 'constructor'.
vlad2005
10-26-2008, 05:02 PM
I work with dataservice and java backend on server. My data has an hierarchical structure with complex properties (arraycollection with List correspondent to java).
Complex data is store o mysql database as blob type.
When i try to delete or update my data i receive this error:
Error: Unknown Property: 'constructor'.
After some search, i think that is an missing with data mapping between flex and java.
How can void this problem?
rawmantick
10-26-2008, 05:44 PM
Probably the keyword conflicts with reserved constructor keyword in flash? Realy have no idea...
vlad2005
10-26-2008, 07:14 PM
I don't have any conflict, my flex application is compiled without any error.
Same with java part.
Below is my data model.
On client side:
package vo
{
import com.adobe.cairngorm.vo.IValueObject;
import mx.collections.ArrayCollection;
[Managed]
[RemoteClass(alias="spa.vo.Company")]
public class Company implements IValueObject
{
public var companyId:int;
public var company:String;
public var personCollection:ArrayCollection = new ArrayCollection();//fill with Person objects
public function Company(){};
}
}
On server side
package spa.vo;
import java.util.List;
public class Company {
private int companyId;
private String company;
private List<Person> personCollection;
public Company(){}
//here is getter and setter methods
}
Any help will be appreciate!
rawmantick
10-26-2008, 07:16 PM
I'm not sure, but as far as I know all properties of volume objects should be public. Am I wrong? Maybe that's the problem?
vlad2005
10-26-2008, 07:22 PM
No. I know many examples where properties is private. Any way, for strong OOP, is recommended that all properties, to be private, and access them with setter and getter methods.
In my error, is mentioned line in declaration of Company class, where is personCollection. So, i think is something about this properties.
rawmantick
10-26-2008, 07:27 PM
No. I know many examples where properties is private. Any way, for strong OOP, is recommended that all properties, to be private, and access them with setter and getter methods.
In my error, is mentioned line in declaration of Company class, where is personCollection. So, i think is something about this properties.
It is absolute overcoding, whern you use private properties and setters/getters for value objects. Yes, I know OOP, and all the things. But setters and getter are for classes with much more complicated construction than just value object... You use setters and getter for some additional actions, that should be hidden from user and make illusion of just changing property. I think it is absolute marasm to duplicate private properties with setters and getters in value objects. Value object is just some name for set of values. Nothing more. So why property+setter+getter instead of just property? 3 times elongated code, and spending time of method call.
edit: but that's just my opinion. Yes, you can provide the private properties with setters/getters.
Anyway, I got nothing to answer for you first post:)
vlad2005
10-26-2008, 07:58 PM
U are absolutely right!
I change all VO, in order to declare properties as public, but same error.
Know an good example about managing hierarchical data, with complex properties for VO?
Flash Gordon
10-26-2008, 08:53 PM
run in debug mode? where does it break?
vlad2005
10-26-2008, 09:21 PM
This is debug log:
Error: Unknown Property: 'constructor'.
at mx.collections::ListCollectionView/http://www.adobe.com/2006/actionscript/flash/proxy::getProperty()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\ collections\ListCollectionView.as:694]
at mx.data.utils::Managed$/normalizeValues()[C:\depot\flex\branches\enterprise_corfu_rc\framewo rks\projects\data\src\mx\data\utils\Managed.as:319]
at mx.data.utils::Managed$/getProperty()[C:\depot\flex\branches\enterprise_corfu_rc\framewo rks\projects\data\src\mx\data\utils\Managed.as:205]
at vo::Company/get personCollection()[E:\projects\spaservice2\src\vo\Company.as:14]
at flash.net::NetConnection/invokeWithArgsArray()
at flash.net::NetConnection/call()
at mx.messaging.channels::NetConnectionChannel/internalSend()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\messag ing\channels\NetConnectionChannel.as:233]
at mx.messaging::Channel/send()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\messag ing\Channel.as:874]
at mx.messaging.channels::PollingChannel/send()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\messag ing\channels\PollingChannel.as:313]
at mx.messaging::ChannelSet/send()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\messag ing\ChannelSet.as:1177]
at mx.messaging::MessageAgent/internalSend()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\messag ing\MessageAgent.as:1083]
at mx.messaging::Producer/internalSend()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\messag ing\Producer.as:146]
at mx.messaging::AbstractProducer/send()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\messag ing\AbstractProducer.as:470]
at mx.rpc::AsyncRequest/invoke()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\As yncRequest.as:133]
at mx.data::DataStore/http://www.adobe.com/2006/flex/mx/internal::doCommit()[C:\depot\flex\branches\enterprise_corfu_rc\framewo rks\projects\data\src\mx\data\DataStore.as:1827]
at mx.data::DataStore/http://www.adobe.com/2006/flex/mx/internal::doAutoCommit()[C:\depot\flex\branches\enterprise_corfu_rc\framewo rks\projects\data\src\mx\data\DataStore.as:1694]
at mx.data::ConcreteDataService/http://www.adobe.com/2006/flex/mx/internal::removeItem()[C:\depot\flex\branches\enterprise_corfu_rc\framewo rks\projects\data\src\mx\data\ConcreteDataService. as:4079]
at mx.data::ConcreteDataService/deleteItem()[C:\depot\flex\branches\enterprise_corfu_rc\framewo rks\projects\data\src\mx\data\ConcreteDataService. as:882]
at mx.data.mxml::DataService/deleteItem()[C:\depot\flex\branches\enterprise_corfu_rc\framewo rks\projects\data\src\mx\data\mxml\DataService.as: 478]
at spaservice2_inlineComponent1/___spaservice2_inlineComponent1_Image1_click()[E:\projects\spaservice2\src\spaservice2.mxml:67]
Line 14 from Company.as, refer to declaration of persoCollection as arrayCollection.
vlad2005
10-26-2008, 09:40 PM
I setup logging tag on jboss server to debug mode, to see any message in console. When i try to delete an item from my data, i don't see any movement on server side.
It's like error occur on client side, before any data to be send to server.
pj-co
10-26-2008, 09:41 PM
why the semi colon ; at the end of the constructor function
public function Company(){}; <----
vlad2005
10-26-2008, 09:45 PM
It's my mistake, sorry.
any way, still not work. Please read and my previous message, about server debugging.
rawmantick
10-27-2008, 04:15 AM
Maybe some incompatibility with List<Person> and Array??? As far as I know, type declarations of value objects on both sides should be the same. You can check the type of your Array with some program, for example Service Capture (http://kevinlangdon.com/serviceCapture/). I'm not sure different-typed values of vo will cast to one another? Maybe I'm wrong...
Once I dealt with getting vo's, but we had all the values of same type.
vlad2005
10-27-2008, 07:23 AM
I resolve that.
Problem, is from java. When i fill with data, on java side need this, in order to handle complex object:
Person m = new Person();
...................................
Object persons = rs.getObject("personCollection");//column in mysql with blob type
List<Person> personCollection = (List<Person>)persons;
m.personCollection = personCollection;
...........................
Now work!
Thanks!
An good tutorial abous serialize/deserialize data with java can be found here (http://www.java2s.com/Code/Java/Database-SQL-JDBC/HowtoserializedeserializeaJavaobjecttotheMySQLdata base.htm)
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.