Ok so I'm making a "simple" web app using the technologies from the topic, recently I found http://www.adobe.com/devnet/flex/articles/flex_hibernate.html so I'm following it and I try to apply it to my app, the only difference being I'm working on a Mac and I'm using MAMP for the database (so no command line for me).
The thing is I'm having some trouble with retrieving/connecting to the database.
I have the remoting-config.xml, persistance.xml, a News.java class (my Entity), a NewsService.java class, a News.as class - all just like in the tutorial. I have of course this line in one of my .mxmls:
<mx:RemoteObject id="loaderService" destination="newsService" result="handleLoadResult(event)" fault="handleFault(event)" showBusyCursor="true" />
And my remoting-config.xml looks like this (well part of it):
<destination id="newsService">
<properties><source>com.gamelist.news.NewsService</source></properties>
</destination>
NewsService has a method:
public List<News> getLatestNews() {
EntityManagerFactory emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT);
EntityManager em = emf.createEntityManager();
Query findLatestQuery = em.createNamedQuery("news.findLatest");
List<News> news = findLatestQuery.getResultList();
return news;
}
And the named query is in the News class:
@Entity
@Table(name="GLT_NEWS")
@NamedQueries({
@NamedQuery(name="news.findLatest", query="from GLT_NEWS order by new_date_added limit 5 ")
})
The handledLoadResult looks like this:
private function handleLoadResult(ev:ResultEvent):void {
newsList = ev.result as ArrayCollection;
newsRecords = newsList.length;
}
Where:
[Bindable]
private var newsList:ArrayCollection = new ArrayCollection();
But when I try to trigger:
loaderService.getLatestNews();
nothing happens, newsList is empty.
Few things I need to point out:
1) as I said I didn't install mysql manually, but I'm using MAMP (yes, the server's running), could this cause some trouble?
2) I already have a "gladm" database and I have a "GLT_NEWS" table with all the fields, is this bad?
Basically the question is how am I suppose to debug this thing so I can find the mistake I'm making? I know that loadData() is executed (did a trace()), but I have no idea what happens with loaderService.getLatestNews()...
@EDIT: ok so I see I'm getting an error in the "fault handler" which says
"Error: Client.Error.MessageSend - Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404: url: 'http://localhost:8080/WebContent/messagebroker/amf' - "