[erlang-questions] Error inserting record into Mnesia

Rick Pettit rpettit@REDACTED
Mon May 31 07:23:45 CEST 2010


On Sun, May 30, 2010 10:51 pm, Igor Ribeiro Sucupira wrote:
> I think it's because you didn't specify the {attributes, [id,
> components, debug_components]} argument when creating the table.

Since he has a record defined I would suggest the following instead:

  {attributes, record_info(fields, active_entity)}

That way you don't have to remember to update both record and table
definitions should the record change in the future.

-Rick

> On Sun, May 30, 2010 at 11:55 PM, Chris Hicks
> <silent_vendetta@REDACTED> wrote:
>>
>> Can anyone point out to me what might be going wrong with the following
>> code? I can't figure out why I keep getting the bad_type error.
>> -record(active_entity, {id=undefined, components=[],
>> debug_components=[]}).
>> 19> Act = #active_entity{}.#active_entity{id = undefined,components =
>> [],               debug_components = []}20>
>> mnesia:create_table(active_entity, [{ram_copies, [node()]}, {type,
>> ordered_set}]).                              {atomic,ok}21>
>> mnesia:dirty_write(active_entity, Act).                                
>>      ** exception exit: {aborted,                       {bad_type,      
>>                     #active_entity{                               id =
>> undefined,components = [],                              
>> debug_components = []}}}     in function  mnesia:abort/1
>> _________________________________________________________________
>> The New Busy is not the too busy. Combine all your e-mail accounts with
>> Hotmail.
>> http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4
>
>
>
> --
> "The secret of joy in work is contained in one word - excellence. To
> know how to do something well is to enjoy it." - Pearl S. Buck.
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>




More information about the erlang-questions mailing list