Hi,
i am relativ new with your orm and playing a little bit around. I guess its a bug, but maybe there is an option to control the length of the column names generated by automapping as a quick workaround?
Your automapping produces a column named
ATTRIBUTES_PATTRIBUTED_OBJECT_ID
which is 32 Chars long, one more then allowed by firebird.
type [Entity][Automapping][Table('autopop')]
TAutoPopulatedItem_Abs = class(TObject)
public
FId : Integer;
FItemType : String;
published
property
ID : Integer
read FId;
property
ItemType : String
read FItemType;
end;
TAutoPopulatedItemAbs = class(TAutoPopulatedItem_Abs)
protected
function InitialItemType : String; virtual; abstract;
public
Constructor Create; virtual;
end;
TAutoPopulatedItemClass = class of TAutoPopulatedItemAbs;
[Entity][Automapping][Table('attribute_abs')]
TPerAttributeAbs=class(TAutoPopulatedItemAbs)
protected
function InitialItemType : String; override;
end;
results in ->
CREATE TABLE attribute_abs (
ID INTEGER NOT NULL,
ITEM_TYPE VARCHAR(255) NOT NULL,
ATTRIBUTES_PATTRIBUTED_OBJECT_ID INTEGER,
CONSTRAINT PK_attribute_abs PRIMARY KEY (ID));
and
ATTRIBUTES_PATTRIBUTED_OBJECT_ID
is 32 instead of 31 chars
That's strange, is that the full mapping you provided here? I have no idea where that name is coming from, especially the "ATTRIBUTES_PATTRIBUTED_OBJECT_" prefix. Usually Aurelius prefix column names with table names when there are associations for example, but I can't see it from your mapping.
No, my fault. The class was referenced/associated by another class.
[Entity][Automapping][Table('attributed')]
[Inheritance(TInheritanceStrategy.JoinedTables)]
[Id('FId', TIdGenerator.IdentityOrSequence)]
TPAttributedObject = class (TObject)
public
FId : Integer;
//FAttrb : TAutoList<TPerAttributeAbs> ; -> this will work
FAttributes : TAutoList<TPerAttributeAbs> ; // -> this wont work
FDef : TAttributeClass ;
Constructor Create; virtual;
Destructor Destroy; override;
published
property
DefinitionClass : TAttributeClass
read FDef write FDef;
published
property
Attributes : TAutoList<TPerAttributeAbs>
read FAttrb;
end;
I solved the error - epxlicitly defining the table names and shortening them.
At the moment i translate a relative big model from TIOPF to Aurelius. It happend a view times that names were a bit to long. For me i looks like that it happens in situations as above, so i think thats a bug.
I changed that in the mean time.
Thanks
Hans Joerg
Ok, that's expected, as I said, it's the default naming mechanism of automapping. You can simply use ForeignJoinColumn attribute to specify the name of the column you want in the table - you don't need to change the table name itself:
[ForeignJoinColumn('MY_COLUMN_ID')]
FAttributes : TAutoList<TPerAttributeAbs> ;