Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3500720
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:46:10+00:00 2026-05-18T12:46:10+00:00

Right away i just try to explain my problem: Using BlazeDS i got the

  • 0

Right away i just try to explain my problem:

Using BlazeDS i got the following Javaclasses:

DatabaseService.java:

public class Database {

 private Category helpCat = null;


 private Category root = new Category(1, "root", null, null);
 private List<Article> database;


 public Database()
 {    


  // ------------ tree -----------------------------------------------------------------------
  List<Category> level_one = new ArrayList<Category>();
  List<Category> level_two_computer = new ArrayList<Category>();
  List<Category> level_tree_hardware = new ArrayList<Category>();

  // Level 1
  Category buecher  = new Category(2, "buecher", root, null);
  Category computer  = new Category(3, "computer", root, level_two_computer);
  level_one.add(buecher);
  level_one.add(computer);

  //Level 2
  Category hardware  = new Category(4, "hardware", computer, level_tree_hardware);
  Category software  = new Category(5, "software", computer, null);
  level_two_computer.add(hardware);
  level_two_computer.add(software);

  //Level 3
  Category graphic  = new Category(6, "graphic", hardware, null);
  Category sound   = new Category(7, "sound", hardware, null);
  level_tree_hardware.add(graphic);
  level_tree_hardware.add(sound);

  // Level 0
  root.addChilds(level_one);
  // ------ tree end ----------------------------------------------------------------------------

  database = new ArrayList<Article>();
  try {
   add(new Book("Per Anhalter durch die Galaxis", "42", Articletype.BOOK, 795, "Per Anhalter durch die Galaxiss", "Douglas Adams", "Heyne Verlag", "Taschenbuch", "3453146972"), buecher);
   add(new Book("Harry Potter und der Stein der Weisen", "descriptionShort", Articletype.BOOK, 1299, "Harry Potter und der Stein der Weisen", "Joanne K. Rowling", "Carlsen Verlag GmbH", "gebunden", "3551551677"), buecher);
   add(new Book("Harry Potter und die Kammer des Schreckens", "descriptionShort", Articletype.BOOK, 1499, "Harry Potter und die Kammer des Schreckens", "Joanne K. Rowling", "Carlsen Verlag GmbH", "gebunden", "3551551677"), buecher);
   add(new Hardware("nVidia GeForce 8400GS", "Graphikkarte", Articletype.HARDWARE, 2665, "512 GDDR5 Speicher, DVI, 1 GPU", "MSI", "neu"), graphic);
   add(new AKW("Biblis C", "Druckwasserreaktor, Preis auf Anfrage, Nur Selbstabholer", Articletype.AKW, -1, "Biblis", 0, 2525, "Siemens", 1, 2012), software);
  } catch (Exception e) {

   e.printStackTrace();
  }
 }

 public List<Category> getCategories(String node) {
  if(node.equalsIgnoreCase("root"))
   return root.getChildren();

  Category baum = null; 
  baum = get_node_by_name(root, node);

  return baum.getChildren();

 }

 private Category get_node_by_name(Category localroot, String lookfor)
 {
  helpCat = null;
  if(localroot.getChildren() != null)
  {
   for (int i = 0; i < localroot.getChildren().size(); ++i)
   {
    if(!(localroot.getChild(i).getName().equals(lookfor)))
    {
     get_node_by_name(localroot.getChild(i), lookfor);
    }
    else
    {
     helpCat = localroot.getChild(i);
     helpCat.setParent(null);
    }
   }
  }
  return helpCat;
 }

 public List<Article> search(int artID, String name, Category categorie){
  List<Article> ergebnis = new ArrayList<Article>();
  if (artID >= 0)
  {
   for(int i = 0; i< database.size(); ++i){
    if(database.get(i).getID() == artID)
    {
     ergebnis.add(database.get(i));
     return ergebnis;
    }
   }   
  }

  if (name != null){
   for(int i = 0; i<database.size(); ++i){
    if (database.get(i).getName().equalsIgnoreCase(name))
     ergebnis.add(database.get(i));
   }
   return ergebnis;
  }
  if (categorie != null){
   {
    ergebnis.addAll(categorie.getArticles());
   }
   return ergebnis;
  }

  return database;
 }


 public Article add(Article newArticle, Category cat) throws Exception
 {
  newArticle.addCategory(cat);
  if(newArticle.getID() != 0)
  {
   throw new Exception("Die Artikel ID wird vom DBS festgelegt!");
  }

  if (database.isEmpty())
  {
   newArticle.setID(0);
  }
  else
  {
   newArticle.setID(database.get(database.size() - 1).getID()+1);
  }

  database.add(newArticle);

  return newArticle;
 }

}

And the Category Class:

  public class Category {
 private int idCat;
 private String nameTEST;
 private Category parent = null;
 private List<Article> articles = new ArrayList<Article>();
 private List<Category> children = new ArrayList<Category>();


 public Category(int _id, String _name, Category _parent, List<Category> _children)
 {
  if(_id > 0)
   idCat = _id;
  if(_name != null)
   nameTEST = _name;
  if(_parent != null)
   parent = _parent;
  if(_children != null)
   children = _children;
 }

 public String toString()
 {
  return nameTEST;
 }

 void addArticle(Article article){
  articles.add(article);
 }

 public List<Article> getAllArticles(){
  List<Article> ergebnis = this.getArticles();

  for (int i = 0; i<children.size();++i){
   ergebnis.addAll(children.get(i).getAllArticles());
  }

  return ergebnis;
 }

 public void setID(int iD) {
  idCat = iD;
 }

 public int getID() {
  return idCat;
 }

 public void setName(String name) {
  this.nameTEST = name;
 }

 public String getName() {
  return nameTEST;
 }

 /**
  * @param parent the parent to set
  */
 public void setParent(Category parent)
 {
  this.parent = parent;
 }

 /**
  * @return the articles
  */
 public List<Article> getArticles()
 {
  return articles;
 }

 public void addChilds(List<Category> _next)
 {
  for (int i = 0; i < _next.size(); ++i)
  {
   children.add(_next.get(i));
  }
 }

 public void addChild(Category one_next)
 {
  children.add(one_next);
 }

 public Category getChild(int index)
 {
  return children.get(index);
 }

 public void removeChild(Article article){
  articles.remove(article);
 }

 public List<Category> getChildren()
 {
  return this.children;
 }
}

also there are of course classes for articles and so on, but thats not important at that point.

the counterpart in flex looks like this:

Category.as

[RemoteClass(alias="PACKAGE.Category")]
 public class Category
 {
  private var idCat:int     = -1;
  private var nameTEST:String    = null;
  private var parent:Category    = null;
  private var articles:ArrayCollection = new ArrayCollection;
  private var children:ArrayCollection = new ArrayCollection;

  public function Category(id:int, name:String, parent:Category, childlist:ArrayCollection, articles:ArrayCollection = null)
  {
   this.idCat   = id;
   this.nameTEST  = name;
   this.parent  = parent;
   this.articles = articles;
   this.children = childlist;
  }

  public function setChildren(childList:ArrayCollection):void
  {
   this.children = childList;
  }

  public function getChildren():ArrayCollection
  {
   return this.children;
  }

  public function getName():String
  {
   return this.nameTEST; 
  }
 }

Then i got a Flex service class calling BlazeDS and executing the getCategories java method. Since Flash dosn’t seem to understand typed arrays, the result from that method which i get back in flex is a simple array of untyped objects (the mapping dosn’t seem to work here, even tought the class category exists in flex and has the same properties).
thats the first thing. but however, i’m converting the untyped objects manually into objects of the category.as class.

the second thing is that categories have child-categories within the java object, which are also ArrayLists of the type category.java. the problem about that: my result event object only contains the first level of categories, looking into them the children are allways null. i dunno why they are empty, since they ARE part of the java object category.

and the third thing (the strangest by fast), you maybe noticed i named the properties of the category.java class strange, like idCat and nameTest instead of simply id and name. why that? because the property names of my flex result objects dont seem to change when i change the java objects properties names (result object properties are named “id” and “name” but the java class object properties are named “idCAT” and “nameTEST”). that it REALLY strange, since if i set the properties, like you see at nameTEST = “TESTNAME” it IS recogniced by flex, only the proertyNAMES dont seem to be recognized at all.

is blaze DS saving / caching the mapping configuration somewhere? how do i get it to rebuild the hole mappings IF so?

that could also explain my problem about the untyped objects i get from java, since before i changed the lists into ArrayLists they where vectors ( which blazeDS dosn’t support AFAIK), and maybe not only the propertynames, but also the propertytypes are hard-mapped at some wired place and blazeds just dosn’t get them refreshed.

i really like checked everything 5 times by now, even redeployed blazeds on the server to make sure no mappings left, but it didnt help at all.

ANY ideas what i could do? (exept changing to another serializer then blazeds (thats what i’m going to do if everything else fails…))

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:46:10+00:00Added an answer on May 18, 2026 at 12:46 pm

    It turns out that a simple missmatch of the classnames was the cause of all evil. still some problems to solve, but atleast i get sub-arrays returned now, only the objects are still simple AS 3 objects and not the specified “Category” and “Article” objects, but i think thats because i dont have all methods included and mapping is failing because of that.

    but thanks for your offer, i appreciate that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simple question that keeps bugging me. Should I HTML encode user input right away
Right now my ant task looks like. <javadoc sourcepath=${source} destdir=${doc}> <link href=http://java.sun.com/j2se/1.5.0/docs/api/ /> </javadoc>
Right now I'm trying to figure out a way to do things smarter, and
Is there a way to detect a right click followed by paste with JavaScript
Right now, I keep all of my projects on my laptop. I'm thinking that
Right now, I'm particularly interested in reading the data from MP3 files (ID3 tags?),
Right, initially ran: c:\regsvr32 Amazing.dll then, (accidentally - I might add) I must have
Right up front: I do not want to start a religious war. I've used
Right, I know I am totally going to look an idiot with this one,
Right now I have a database (about 2-3 GB) in PostgreSQL, which serves as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.