Follow up on: Web3J: TypeError: MyContract is not a constructor
Here is how my contract looks like:
contract OrganisationsFactory {
mapping(string => OrganisationObject[]) organisations;
event CreatedOrg(address indexed hsAddr);
function add(string name, string vat, string headquaterAddress) public returns(address) {
OrganisationObject newOrg = new OrganisationObject(name, vat, headquaterAddress);
organisations[name].push(newOrg);
CreatedOrg(newOrg);
return newOrg;
}
function get(string name) public returns(OrganisationObject[]){
return organisations[name];
}
}
contract OrganisationObject {
struct organisationDetails {
string name;
string vat;
string headquaterAddress;
}
organisationDetails public details;
address[] public staff;
function OrganisationObject (string name, string vat, string headquaterAddress){
details.name = name;
details.vat = vat;
details.headquaterAddress = headquaterAddress;
}
function addStaff(address x){
staff.push(x);
}
}
My aim is to create a contract on the chain containing the details of an organisation, to then be retrieve in the future. Basically just like a database. If I follow your approach I will compile a new contract every time, I will therefore never know where is my "organisation" kept unless I keep a reference to it contract in a conventional database.
Is there a better way then my approach to deal with this ?