Re: NOT NULL fields..

From: Alex Gunawan Wibowo (netzone_tec..ahoo.com)
Date: Tue Nov 23 2004 - 22:16:55 EST

  • Next message: Andrus Adamchik: "Re: NOT NULL fields.."

    Ok... I've had a little clue...

    I can use the method "isMandatory()" from
     org.objectstyle.cayenne.map.DbAttribute..

    ( the XML mapping file has property "isMandatory"
    which
    I strongly believe means whether that field has the
    attribute "NOT NULL")
    the question now is how do i instantiate this
    DbAttribute.

    I have this snipplet from the web..
    -------------------------------------
            Iterator it = ent.getAttributes().iterator();
            ....
            DbAttribute at = (DbAttribute) it.next();
    --------------------------------------
    Not too sure about this, but I guess that
    "getAttributes()" is a method from class
    org.objectstyle.cayenne.map.Entity.

    THis is what I think:
     I have to instantiate this Entity class,
     and call it's "setDataMap()" method.
     --> I think setDataMap is setting which XML data
         mapping file.

    Now the problem is, how do i get the DataMapping
    file??
    Is it stored somewhere?
    If it has to be read manually everytime, that will
    really really slow down the whole system (parsing XML
    files)...

    Sorry if this is a bit messy...
    But I hope you get the overall picture..

    Best regards,

    Alex.

    --- Alex Gunawan Wibowo <netzone_tec..ahoo.com>
    wrote:

    > Hello,
    >
    > Does anyone know if Cayenne can check if a
    > particular
    > field in a table is required to be filled (i.e. NOT
    > NULL)?
    >
    > I'm developing an application with Struts, and I
    > want
    > this behaviour to check if a particular field has
    > been
    > provided by the user.
    > I can manually code this behaviour by reading a
    > property file.. but that is a bit dirty i would say.
    > (i.e. a change in the database schema would require
    > a
    > change in the property file, etc etc).
    >
    > Thank you very much for the help!
    >
    >
    > Best regards,
    >
    > Alex Wibowo
    >
    > =====
    > Alex Wibowo
    > ~ Second is a failure ~
    > The University of Melbourne
    > Department of Computer Science and Software
    > Engineering
    > Website - http://www.cs.mu.oz.au/~agwibowo
    > Team Wasabi -
    > http://www.cs.mu.oz.au/SE-projects/s440gh
    > ==============================================
    >
    >
    >
    > __________________________________
    > Do you Yahoo!?
    > All your favorites on one personal page Try My
    > Yahoo!
    > http://my.yahoo.com
    >

                    
    __________________________________
    Do you Yahoo!?
    Meet the all-new My Yahoo! - Try it today!
    http://my.yahoo.com
     



    This archive was generated by hypermail 2.0.0 : Tue Nov 23 2004 - 22:16:59 EST