Error inserting new record with Flex 4 via ColdFusion 9 with Apptacular extension
I have a little problem with using Flex 4 with Coldfusion 9. I hope you can tell me what I have to fix.
I use Coldfusion 9, hosted on my development machine.
- I created a table in MySQL database with 2 columns:
idPlayer
as integer and auto increment. 2nd column isName
. - I use a ColdFusion Builder, Apptacular, to generate solid CFC service for me. It generates
PlayerService.cfc
here. - Now I use Flash Builder 4's data wizard to generate data service class from
PlayerService.cfc
. I create a form onupdate
method of that service. Ok, now look at the generated code.
// Please uncomment the below line if Data Management is enabled for Player and update is used as the create function.
// var player:Player = new Player();
So I uncommented the code and run the form. After fill the data, and click update, the pop up appear like this:
Unable to invoke CFC - Field 'idPlayer' doesn't have a default value For details, turn on Robust Exception Information in the ColdFusion Administrator
So I don't know how Apptacular generate the code to work as ORM. But it should have some way or workaround to let the system act with idPlayer has no def开发者_运维知识库ault value to insert other columns and generate idPlayer as auto-increment value (as I set in MySQL).
Could you help me solve this?
I don't know what your Player.cfc looks like (that's where the error is actually happening), but you'll need to set the generator attribute of the id property to let Hibernate know that the database is supposed to take care of that for you. You'll most likely have the exact same error if you tried to save the object via ColdFusion, so test your Service using CF first, and then move onto Flash so that you know if your issue is really with your Flex integration, or with your CF app.
精彩评论