How to associate both a collection and one item of this collection to an entity

I'm working on a project in which I have an entity, we may call Users and another entity
Address.
I want to define the entity User in a way that an user would have a collection of addresses (typically a One-To-Many relationship), but I also need an attribute of user, let it be
main_address that would target a single value of the previous collection.
I would like to know if there is a conventional of doing this. The only solution I have now is to create another One-to-One relationship between
Users . main_address and Address but this does not insure that the
main_address will actually be part of the User . addresses collection.
I don't know if it could be important, because it's a rather theoretical question, but I'm using Doctrine 2.

Add a field main_address_id in the User entity or table that holds the ID of the Address record that is the main one. Make that a one to one relationship, if you like.
The only solution I have now is to create another One-to-One relationship between
Users.main_address and Address but this does not insure that the
main_address will actually be part of the User.addresses collection.
Quite right. You need another mechanism that insures that. You can either validate that in your business logic, or use a stored procedure or trigger on the RDBMS during creation or editing of
User that enforces this restriction.
Doctrine might have a "business rules" module that you can use. The point is that the additional restriction you are imposing on
main_address_id doesn't have anything to do with your database schema, per se. It's a business rule, basically.

Similar Messages

  • All of my ringtones were deleted on the latest update. Both purchased ringtones and ones that I made myself. How do I recover them?

    All of my ringtones were deleted when I updated to 5.1. Both purchased ringtones and ones that I created myself have disappeared. How do I recover them?

    If for some reason you failed to make sure that everything was on your comuter before updating , then you will have to redownload:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • How to get both OTF data and spool at a time

    Hi Experts,
        My requirement is to get both OTF data and spool.
    In 'OPEN_FORM' i tried passing itcpo-TDGETOTF = 'X'. itcpo- TDNEWID = 'X'.
    I was able to get OTF data but spool is not getting generated.
    IF i pass only itcpo- TDNEWID = 'X'. the spool is getting generated but not OTF data.
    when both the fields are set i.e. itcpo-TDGETOTF = 'X'. itcpo- TDNEWID = 'X'.
    the spool is generation is getting supressed.
    Similarly when i tried to get OTF data by passing itcpo-TDGETOTF = 'X'. to 'OPEN_FORM' as i need to convert it to PDF and send it to vendors as email ,
    The print preview in TCODE ME23n was not getting generated for 'MESSAGE' option 'External send'.
    Please suggest me how to get both OTF data and spool at a time.

    Hi Kartik,
    This one is similar to my question to print and email invoice at same time.  I pass itcpo-tdgetotf = 'X' in order to get otfdata and send email with the attachment of otfdata.
    Now I have data in otfdata, but when I call print_otf function, I clear out itcpo-tdgetotf, and passed
    itcpo-tddest = device_type but I still get error message said 'Handler not valid for open spool request'.
    Can you give me a working example that you have otfdata table and print data from that table.  I also post my question on other thread
    submit report and export to memory
    thanks

  • Can I load Microsoft Office Word 2011 for MAC on an IPAD 2?  If yes, then how?  I have the software and one more load opportunity left.

    Can I load Microsoft Office Word 2011 for MAC on an IPAD 2?  If yes, then how?  I have the software and one more load opportunity left.
    Reason that I ask is that I'm worried that I will not be able to read or work word or excel docs that people send me.

    No. Office 2011 for Mac is coded to run with OS X. In order to work on the iPad the app must be coded for iOS instead.
    If you look in the iTunes App Store, you will find that there are many apps that allow you to work with Office files on an iPad.
    Allan

  • -I have a password protected excel spreadsheet, how can I get my iPads and iPhones to read this and save it password protected?

    I have a password protected excel spreadsheet, how can I get my iPads and iPhones to read this and save it password protected?

    Documents to Go says that it, "Opens password protected Excel 97-2008 files", but does not say whether it can save them as "password protected".
    This might work for you.

  • How do I transfer my photos and other items from the cloude to my Dell desktop

    How do I transfer my photos and other items from the cloud to my Dell
    desktop

    Hello johnfromwildomar,
    Thank you for using Apple Support Communities.
    You can use the following articles to help you set up to share photos from iCloud to your computer.
    iCloud: Set up My Photo Stream
    iCloud" My Photo Stream FAQ
    Regards,
    Jeff D. 

  • HT1339 my older iPod my husband wants to use and his netbook does not have cd drive. How do I down load iPod and iTunes info for this product so he can now use it?

    my older iPod my husband wants to use and his netbook does not have cd drive. How do I down load iPod and iTunes info for this product so he can now use it?

    Your question(s) is/are a little hard to understand.  So your husband has an iPod as well as a netbook and he wants to be able to sync iPod with this netbook is that correct?  If so, he'll need to first download and install iTunes assuming the netbook is running some version of Windows such as 7, Vista, or XP.
    http://www.apple.com/itunes/download/
    As for importing or ripping music, he'll have to either use an external CD/DVD drive that is attached via USB or rip the songs to another PC you have with a built in CD/DVD drive.  Once you have imported them to the other computer, you can transfer the songs to an external hard drive or to his iTunes library via Home Sharing.
    If this isn't quite what you were looking for, please clarify.
    B-rock

  • How to enable both WS Security and MTOM

    I am trying to call a web service running in JBoss. The web service is enabled with both ws
    security and MTOM as per the requirement. When i am trying to call the web method from my
    java client, i am getting the below exception
    Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Endpoint
    {http://wsg.hpos.om.hp.com/}HPOSGatewayPort does not contain operation meta data for:
    {http://www.w3.org/2001/04/xmlenc#}EncryptedData
    at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.getSOAPFaultException
    (SOAPFaultHelperJAXWS.java:72)
    at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.throwFaultException
    (SOAP11BindingJAXWS.java:109)
    at org.jboss.ws.core.CommonSOAPBinding.unbindResponseMessage
    (CommonSOAPBinding.java:579)
    at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:381)
    at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:300)
    at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:166)
    at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:152)
    at $Proxy17.getName(Unknown Source)
    at wsclient.TestHPOSClient.main(TestHPOSClient.java:106)
    my client code is:
    URL endpoint_new = new URL("http://15.70.176.190:9000/HPOSGateway/HPOSGateway?wsdl");
    QName qname = new QName("http://wsg.hpos.om.hp.com/", "HPOSGatewayService");
    HPOSGateway port = new HPOSGatewayService(endpoint_new,qname).getHPOSGatewayPort();
    BindingProvider bp=(BindingProvider)port;
    SOAPBinding binding = (SOAPBinding)bp.getBinding();
    binding.setMTOMEnabled(true);
    Map<String,Object> map = bp.getRequestContext();
    map.put(BindingProvider.USERNAME_PROPERTY,"administrator");
    map.put(BindingProvider.PASSWORD_PROPERTY,"da1sy");
    URL securityURL = new File("c://jboss-wsse-client.xml").toURL();
    ((StubExt)port).setSecurityConfig(securityURL.toExternalForm());
    ((StubExt)port).setConfigName("Standard WSSecurity Client");
    map.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
    "http://15.70.176.190:9000/HPOSGateway/HPOSGateway");
    System.setProperty("org.jboss.ws.wsse.keyStore", "c:\\wsse.keystore");
    System.setProperty("org.jboss.ws.wsse.trustStore", "c:\\wsse.truststore");
    System.setProperty("org.jboss.ws.wsse.keyStorePassword", "jbossws");
    System.setProperty("org.jboss.ws.wsse.trustStorePassword", "jbossws");
    System.setProperty("org.jboss.ws.wsse.keyStoreType", "jks");
    System.setProperty("org.jboss.ws.wsse.trustStoreType", "jks");
    System.out.println(port.getName("Welcome to this testing part."));
    ,, my jboss.wsse.client.xml is...
    <?xml version="1.0" encoding="UTF-8" ?>
    <jboss-ws-security xmlns="http://www.jboss.com/ws-security/config"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.jboss.com/ws-security/config http://www.jboss.com/ws-
    security/schema/jboss-ws-security_1_0.xsd">
    <config>
    <encrypt type="x509v3" alias="wsse" />
    <requires>
    <encryption />
    </requires>
    </config>
    </jboss-ws-security>
    and my jboss-wsse-server.xml is ...
    <?xml version="1.0" encoding="UTF-8"?>
    <jboss-ws-security xmlns="http://www.jboss.com/ws-security/config"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.jboss.com/ws-security/config http://www.jboss.com/ws-
    security/schema/jboss-ws-security_1_0.xsd">
    <key-store-file>WEB-INF/wsse.keystore</key-store-file>
    <key-store-password>jbossws</key-store-password>
    <trust-store-file>WEB-INF/wsse.truststore</trust-store-file>
    <trust-store-password>jbossws</trust-store-password>
    <config>
    <encrypt type="x509v3" alias="wsse"/>
    <requires>
    <encryption/>
    </requires>
    </config>
    </jboss-ws-security>
    i have my web service annotations like below.
    @WebService(name="HPOSGateway",targetNamespace="http://wsg.hpos.om.hp.com/")
    @EndpointConfig(configName = "Standard WSSecurity Endpoint")
    @BindingType(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING)
    @HandlerChain(name = "HPOSGateway_handlerChain", file = "HPOSGateway_handler.xml")
    public class HPOSGateway{
    Can any one help me what is the problem and where i need to change? Please it is very
    urgent.
    Regards
    Ramchand

    Welcome to the forum!
    Even if it were physically possible, you wouldn't be able to use both Ethernet ports at the same time, because the motherboard doesn't support more than one connection at the time.
    Cheers,
    George
    In daily use: R60F, R500F, T61, T410
    Collecting dust: T60
    Enjoying retirement: A31p, T42p,
    Non-ThinkPads: Panasonic CF-31 & CF-52, HP 8760W
    Starting Thursday, 08/14/2014 I'll be away from the forums until further notice. Please do NOT send private messages since I won't be able to read them. Thank you.

  • How to load both 32 bit and 64 bit version of addon on same machine

    Hi,
    When deploying an addon using SAP Business One Extension Manager, how can we install both 32 bit and 64 bit version of the addon for same machine?
    If the OS is 64 bit, SAP allows to install and use both 32 bit SBO client and 64 bit SBO client. I want that when the 32 bit SBO client is used, my 32 bit addon should get loaded, and when 64 bit client is used, my 64 bit addon should get loaded.
    But the SBO Extension Manager loads the addon for a given company; there seems to be no option to specify different addon files for 32 bit and 64 bit.
    Is there a way?
    Thanks.

    Hi Rajesh,
    There might be the problem while creating the add-on.
    It is the system behavior that once you login to 32 bit SAP Client, you can use only 32 bit Add-on. Means 32 bit add-on will be loaded automatically.
    Same is in the case of 64 Bit.
    What you have to do is:
    If OS is 64 Bit and you have installed both 32 and 64 Bit SAP Client then once open 32 bit client and install only 32 bit add-on
    Then open 64 Bit SAP Client and  install only 64 bit add-on.
    By doing this you will be able to use 32 bit add-on on 32 bit SAP Client and vice versa.
    Hope it helps.
    Thanks & Regards
    Ankit Chauhan

  • How to protect both access (http and https) with a Policy Agent

    Hi,
    During the installation of a web Policy Agent (i.e. Policy Agent for IIS) we have to choose the protocol (and port) of the web server we want to protect.
    If we have an IIS with secure (https) and non secure (http) applications, how we manage this scenario with the policy agent?
    Regards,

    Hi,
    Finally, i have installed the agent in IIS5 in the non secure port (http) and in fact it detects both access (http and https) fine.
    The problem now is that if i try to access to a non secure url ( http://mynonsecureapp.com ) all works fine, the agent redirects to https://myaccessmanager.com:443/amserver/UI/Login?goto=http://mynonsecureapp.com but when i try to access to a secure url ( https://mysecureapp.com ) the agent try to redirects me to: https://myaccessmanager.com:443/amserver/UI/Login?goto=http://mysecureapp.com (notice that the agent removes the 's' in the url).
    The amAgent log file shows:
    +2008-07-17 09:44:08.296MaxDebug 656:d8f6b0 PolicyAgent: am_web_is_notification(), https://sigcit.agp.gva.es:443/fullcitriweb is not notification url http://sigcit.agp.gva.es:80/amagent/UpdateAgentCacheServlet?shortcircuit=false.+
    +2008-07-17 09:44:08.296 Warning 656:d8f6b0 PolicyAgent: OnPreprocHeaders(): Access Manager Cookie not found.+
    +2008-07-17 09:44:08.296 Debug 656:d8f6b0 PolicyAgent: am_web_is_access_allowed(): url 'https://sigcit.agp.gva.es:443/fullcitriweb' path_info ''.+
    +2008-07-17 09:44:08.296MaxDebug 656:d8f6b0 PolicyAgent: am_web_is_access_allowed(): processing url http://sigcit.agp.gva.es:80/fullcitriweb.+
    +2008-07-17 09:44:08.296 Debug 656:d8f6b0 PolicyAgent: am_web_is_access_allowed(): client_ip 172.27.65.62 not found in client ip not enforced list+
    Any ideas?
    Regards,
    Edited by: idm_oceanic on Jul 17, 2008 1:33 AM

  • How to use both ojdbc14.jar and ojdbc6.jar in same weblogic domain(weblogic12C)

    Hi all,
    I 'm having issue of using both ojdbc14.jar and ojdbc6.jar in same weblogic application and same weblogic domain in weblogic 12C environment.
    how can i do that?
    i'm currently having application developed using jdk 1.6 and ojdbc6.jar, application developed using jdk 1.4 and ojdbc14.jar.both are currently installed at same domain.
    i want to use the both ojdbc14.jar and ojdbc6.jar in same domain.
    what i previously did was renaming /usr/weblogic/wls_server10.3.4/lib/ojdbc6.jar to /usr/weblogic/wls_server10.3.4/lib/ojdbc6.jar.bak and put ojdbc14.jar in the same path when i wanna use ojdbc14.jar.
    i haven't use both in same environment before, but to go live i wanna match about requirement.pls help.
    i know the way use this by having two domains, but in the same domain i could not find a solution yet.
    Please help

    Hey
    I have the similar requirement.. Did you managed to get an option of doing it? If yes, please provide some insights
    Thanks in Advance

  • How to install web face recognition and one touch rescue point in a lenovo g560 laptop

     hi,
          can anybody tell me the way how can i install web face recognition and one touch rescue system in lenovo laptops which i purchased with free dos as i am having windows xp license with me,
    Regards

    you can find and install softwares and drivers from the link below :
    http://consumersupport.lenovo.com/us/en/DriversDownloads/drivers_list.aspx?CategoryID=67873

  • KM4M how to enable both onboard video and video card radeon 7000

    My motherboard is KM4M and I have a radeon 7000(this card has 2 heads: one DVI and one VGA), actually I need 3 monitors at the same time. when I install the card, the onboard video disappeared. how to enable all of them?
    windows 2003
    athlon xp 2800
    Thansks

    all onboard vga turn of once a vga cards put in
    the 7000 and another pci vga card should work

  • How to get both, the ResultSet and Output (return value) from Oracle Stored Procedure

    Hi! I am doing a conversion from MSSQL to Oracle with C++ and MFC ODBC. Any comment is appreciated!! I have Oracle 8i and Oracle ODBC 8.1.6 installed.
    My question is how to retrieve the return value AND ALSO the resultSet at the same time by using Oracle function without modifying my souce codes (except puttting mypackage. string infron of my procedure name, see below).
    -- My source code in C++ with MSSQL ....
    sqlStr.Format("{? = call ListOfCustomers(%i)}", nNameID);
    RcOpen = CustomerList.Open(CRecordset::forwardOnly, sqlStr, CRecordset::readOnly );
    Where CustoemrList is a Crecordset object...
    IN DoFieldExchange(CFieldExchange* pFX) I have ...
    //{{AFX_FIELD_MAP(CQOSDB_Group)
    pFX->SetFieldType(CFieldExchange::outputColumn);
    RFX_Long(pFX, T("Name"), mCustoemrName);
    //}}AFX_FIELD_MAP
    // output parameter
    pFX->SetFieldType( CFieldExchange::outputParam );
    RFX_Int( pFX, T("IndexCount"), mCustomerNumber);
    -- m_CustomerNumber is where i store the return value!!!
    -- In Oracle Version, i have similar codes with ...
    sqlStr.Format("{? = call mypackage.ListOfCustomers(%i)}", nNameID);
    RcOpen = CustomerList.Open(CRecordset::forwardOnly, sqlStr, CRecordset::readOnly );
    -- I have oracle package/Body codes as following...
    create or replace package mypackage
    as
    type group_rct is ref cursor;
    Function listgroups(
    nameID NUMBER ,
    RC1 IN OUT Mypackage.group_rct ) return int;
    end;
    Create or replace package body mypackage
    as
    Function listgroups(
    NameID NUMBER ,
    RC1 IN OUT Mypackage.group_rct )return int
    IS
    BEGIN
    OPEN RC1 FOR SELECT Name
    from Customer
    WHERE ID = NameIDEND ListGroups;
    END
    return 7;
    END listgroups;
    END MyPackage;
    Ive simplified my codes a bit....
    null

    yes, it is exactly what i want to do and I am using Oracle ODBC driver.
    I tried using procedure with 1 OUT var fo numeric value and the other IN OUT ref cursor var instead of function, but error occurs when I called it from the application. It give me a memory ecxception error!!
    sqlStr.Format("{? = call ListOfCustomers(%i)}", nNameID);
    RcOpen = CustomerList.Open(CRecordset::forwardOnly, sqlStr, CRecordset::readOnly );
    it seems to me that the ? marker var is making all the trouble... can you please give me any more comment on this?? thanks!
    null

  • Sales order BOm with Both Header material and line item delivery

    Hi,
           We have one requirment   we have two products  Products  A  and B, when we are salling only product B we have some amount for that e.g 1000  rupees   but when we are salling product A  along with this product B is free of cost   so as in SO it is not accepting the 0 amount  thats why while making SO for product A  we reduce 1 rupee from product A   and that 1 rupee we are adding for the Free item B   but now every time we have to add both material in SO
      So is there any way  when we make the So for product A  automatically product B should come in So and price of product A is from VK11  but price of B should always be 1 and while creating delivery with VL01 both material we want to delivery and do the PGi  in the same way we required billing doucment for both the material and in case we are salling only product B price  should be from VK11.
      How to customize the system for above requirement.
    regards,
      zafar

    Hi Zafar,
    Free goods determination is not supported in SAP for structured material like BOM.
    For your requirement, you need not have to create a BOM materiall, simple free goods determination is suitable.
    You can create an Exclusive free goods condition record where material A will be the main item and material B will be the sub item (free of charge).
    So create the Condition record for Exclusive free goods in VBN1.
    When you will create the Sales order for material A, system will take the above materials "A" as Main item (Item category TAN) and "B" Sub-item (Item category TANN) respectively.
    When you will create DELIVERY , both the items will be delivered and you can do PGI.
    As and when required you can also sell material B separately.
    Regards
    Pradyumna

Maybe you are looking for

  • LabVIEW 7 for Linux can not display non English character

    Hello, Unsing LabVIEW 7 under SUSE Linux 10, I find that when input Chinese character to a string control , it just can displays a corrupt strings. Anyone knowing how to resolve the problem ? Thanks. David

  • Matrox MXO2 Mini and CS6 Windows?

    I got a Blackmagic Intensity Pro card to monitor the Premiere CS6 timeline, which turned out to have very mediocre performance since half the times I press play the audio lags one second behind the video. So I'm going to return it and get something e

  • Can I use this scanner?

    Dear all, I am considering getting a DocuPen RC800 scanner (see <http://www.planon.com/>). The scanner apparently needs a download, and cannot use the (Windows) software supplied (see <http://www.planon.com/drivers.php>, about 2/3 the way down the pa

  • How can I get my second generation shuffle to accept all songs?

    When I try to add certain songs, it will not copy them. It will begin the synching process, then cancel synching. I will check the playlist and the song will not be there. I retry multiple times. It is not because the memory is full. It will let me a

  • Remove Zen from the Windows Shell Integration (using RegSvr32 ?)

    When I right mouse click on a a desktop icon the popup menu is so long it doesn't all fit on the screen. I have noticed I have two sets of Zen commands. I can't see how to get rid of them completely. I believe I can use the Regsvr32 /u command but I