The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

'Unkown' type when generating classes for a MySQL view

Last post 06-28-2008, 2:07 AM by dguaraglia. 13 replies.
Sort Posts: Previous Next
  •  06-26-2008, 1:33 AM 9993

    'Unkown' type when generating classes for a MySQL view

    Hello guys,

    I'm having quite a hairy problem when generating code for a view on MySQL. I'm using MySQL server version '5.0.27-community-nt', on a Windows XP SP3 machine, with MyGeneration 1.3.0.3 and ES2008.

    I create the view like this:

     

    Code:
    CREATE VIEW ClientList AS 
    SELECT
    Id, ReferenceNumber AS Reference, FirmName AS Name, Address1 AS `First address`, Address2 AS `Second address`, City, County, CONCAT(OutCode,' ', InCode) AS Postcode,
    Telephone, Fax, Email AS Email, Active FROM clients
     
    And this is what I get when I generate the code (this is an excerpt from ClientlistMetadata's constructor):
    Code:
    Protected Sub New()
    _columns = New esColumnMetadataCollection()
    Dim c as esColumnMetadata

    c = New esColumnMetadata(ClientlistMetadata.ColumnNames.Id, 0, GetType(Unknown), esSystemType.Unassigned)
    c.PropertyName = ClientlistMetadata.PropertyNames.Id
    c.HasDefault = True
    c.Default = "0"
    _columns.Add(c)


    c = New esColumnMetadata(ClientlistMetadata.ColumnNames.Reference, 1, GetType(Unknown), esSystemType.Unassigned)
    c.PropertyName = ClientlistMetadata.PropertyNames.Reference
    _columns.Add(c)
     
    I tried selecting the DbTarget, etc. as posted by David on the previous topic regarding this same problem, but that doesn't solve it.
    Any ideas?
    Cheers,
    David 
     
    UPDATE: I moved my project to ES2007, and it seems to work flawlessly, so it's an ES2008 exclusive thing. I'll develop using ES2007 for now I guess, until I get a solution. 
    Filed under:
  •  06-26-2008, 4:16 AM 9997 in reply to 9993

    Re: 'Unkown' type when generating classes for a MySQL view

    Our recommendation is MyGeneration 1.2, we have removed all links to MyGeneration 1.3 from our site. Was this issue just with this one view and ES2008 or did it involve tables and other views? 

    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  06-26-2008, 5:44 AM 10004 in reply to 9997

    Re: 'Unkown' type when generating classes for a MySQL view

    Well, there were other issues too. It seems MyGeneration 1.3 doesn't correctly detect MySQL 'relations' (foreign keys) either, so it wasn't generating the hierarchical structure. I just moved back to 1.2. If only there was a way to disable that annoying upgrade nag screen...

    Cheers,

    David

  •  06-26-2008, 6:16 AM 10007 in reply to 10004

    Re: 'Unkown' type when generating classes for a MySQL view

    There is a way to disable that. In the MyGeneration menu Edit -> Default Settings then on the "Misc" uncheck the "Check for New Build When Launched" checkbox.
    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  06-26-2008, 6:28 AM 10008 in reply to 10007

    Re: 'Unkown' type when generating classes for a MySQL view

    Oh! Great! I'm removing everything MyGeneration 1.3 related, so I don't get in this cul-de-sac again next time I start a project. Thanks for the help! :)
  •  06-27-2008, 5:28 AM 10021 in reply to 10007

    Re: 'Unkown' type when generating classes for a MySQL view

    BTW, I've been using ES2007 since yesterday. Today I tried using 2008 with MyGeneration 1.2.0.7 and the recommended mysql.data provider (5.0.7), and I still get the error. I think I'll go on using ES2007 for now, but it's a pity, because I was interested in trying a few things in ES2008 :(
  •  06-27-2008, 7:46 AM 10027 in reply to 10021

    Re: 'Unkown' type when generating classes for a MySQL view

    Here is what I'm getting for our test View using ES2008.1.0623.0, MySQL 5.0.18, MyGen 1.2.0.7, with Connector 5.0.7 copied into the MyGeneration Program folder:

    Code:
    '                       EntitySpaces Version # 2008.1.0623.0
    '                       MyGeneration Version # 1.2.0.7
    '                       Date Generated       : 6/27/2008 10:18:08 AM
    ' ...
    
    c = New esColumnMetadata(FullNameViewMetadata.ColumnNames.FullName, 0, GetType(System.String), esSystemType.String)	
    c.PropertyName = FullNameViewMetadata.PropertyNames.FullName
    c.CharacterMaxLength = 42
    c.IsNullable = True
    _columns.Add(c) 
        
        
    c = New esColumnMetadata(FullNameViewMetadata.ColumnNames.DepartmentID, 1, GetType(System.Int32), esSystemType.Int32)	
    c.PropertyName = FullNameViewMetadata.PropertyNames.DepartmentID
    c.NumericPrecision = 11
    c.IsNullable = True
    _columns.Add(c) 
    
    '...

    The Driver in Default Settings must be "MySQL2". Other than that for ES2008 we do not use the other MyGen settings. We use our own with the EntitySpaces.MetadataEngine.


    David Neal Parsons
    www.entityspaces.net
  •  06-27-2008, 8:09 AM 10028 in reply to 10027

    Re: 'Unkown' type when generating classes for a MySQL view

    It must be one of those stupid MySQL version errors, for everything but the version number is the same. I remember not long ago MySQL 5.0.27 on Debian was giving me a hard time too. I'll try to grab version 5.0.18 and try with that. I'll update as soon as I can!

  •  06-27-2008, 8:32 AM 10029 in reply to 10027

    Re: 'Unkown' type when generating classes for a MySQL view

    Nope, still no luck. I've just downloaded the latest version of MySQL (5.0.51b-community-nt), installed it, but I still get the unknown fields.

    Now, you say you are not using MyGeneration to generate the template... are you using it to read the metadata though? Because MyMeta shows the correct data types, so it should be working all right if you used that as the detection mechanism. Maybe that's why it works with ES2007?

    I could send you a copy of my database schema if it helped you debug it. Do you want me to do that?

    Cheers,

    David

  •  06-27-2008, 11:17 AM 10033 in reply to 10029

    Re: 'Unkown' type when generating classes for a MySQL view

    This is strange, I have this kind of troubles too (with VistaDB and SQL Server). Currently I have find out a workaround for me. This happends, only if I open MyGeneration project with double-click. If I open MyGeneration from start/programs menu and then the project, it's working.
     

  •  06-27-2008, 11:23 AM 10034 in reply to 10033

    Re: 'Unkown' type when generating classes for a MySQL view

    Ahhh, that might explain some of these issues, it could be the start path and it cannot find the esLanguages.xml file. Thanx fruzicka, that would have never occurred to me, let's hope that this is the issue.
    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  06-27-2008, 11:34 AM 10035 in reply to 10034

    Re: 'Unkown' type when generating classes for a MySQL view

    Big Smile Glad to help you. For now I'm happy with this workaround. I didn't test it with mygen1.3.0.3.

  •  06-27-2008, 3:42 PM 10044 in reply to 10035

    Re: 'Unkown' type when generating classes for a MySQL view

    I hope dguaraglia chimes in so we can see if this was his issue too?

    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  06-28-2008, 2:07 AM 10050 in reply to 10044

    Re: 'Unkown' type when generating classes for a MySQL view

    Brilliant! That *did* solve it. Before trying this I was invoking MyGeneration three different ways:

    1. Using Find and Run Robot (a quick program launcher)
    2. By clicking on the project file
    3. From a NAnt script

    Both 2 and 3 are out of question now. I might be able to fix 3 using the "workingdir" parameter to the <exec> tag, but didn't test it yet.

    Well, happy to finally have a workaround! Thank you fruzicka for the heads up! And Mike, do you think you'll be able to fix this by next release?

    Cheers!

View as RSS news feed in XML