Many to one relationships strange behavior

I have a problem with two many to one relationships.
The problem appears from the dirty mechanism of cmr/cmp fields.
When I have two “many-to-one” relationships ex:
A n..1 B
A n..1 C
Navigability: B -> A
          A <-> C
When I put in ejb-jar.xml the B to A relation first, the bugs appear. The dirty mechanism work chaotic. The problem is in the generated code for the PersistenceManager and Wrapper of the A bean.
In the Wrapper the only fields with dirty mecansim are the real fields from bean which are navigable. In the PersistenceManager class are the same fields like in the BeanWrapper plus the fake fields for relationship. But the fake fields are intercalated with real fields and the dirty flag values are not the same with the dirty flags from BeanWrapper. Result: chaotic updates.
Solution(workaround – not elegant): put first the relation which has navigability from A to C and second A to B.

They way I handle this is to hide the creation/manipulation/deletion of the bean behind a manager - for example a singleton session bean. I NEVER allow the direct creation/deletion of entity beans except through manager classes. This is quite a common J2EE pattern, whose name escapes me at the moment.
Your manager would have a method like delete(int productId), which would delete the matching Product entity bean, and would then search the OrderLineItem beans for the matching Product primary key.

Similar Messages

  • Many-to-one relationships

    I'm trying to implement a many-to-one relationship similar to the one, for example, between an OrderLineItem and a Product.
    I managed to create the beans and define the relationship using deploytool.
    What I'm trying to understand is how can I prevent a Product instance from being deleted when it is involved in the relationship described above?
    Currently, under Sun's reference implementation server, I am allowed to delete a Product even if there are OrderLineItems that reference it.
    There is one line printed out in the window running j2ee -verbose:
    com.sun.ejb.containers.EntityContainer$EJBTxKey
    The record in the Product table is deleted nonetheless.
    Another weird thing is that the server does not allow me to deploy two beans involved in a many-to-one relationships with the Product bean if they are using the same CMR field name. What I get is a compilation error at the deployment time.
    I'd appreciate any input.

    They way I handle this is to hide the creation/manipulation/deletion of the bean behind a manager - for example a singleton session bean. I NEVER allow the direct creation/deletion of entity beans except through manager classes. This is quite a common J2EE pattern, whose name escapes me at the moment.
    Your manager would have a method like delete(int productId), which would delete the matching Product entity bean, and would then search the OrderLineItem beans for the matching Product primary key.

  • SD Billing document many to one relationship with sales order

    Hi experts,
    We have a scenario where we have done collective billing for some time.  So, obviously we have from sales order to billing one to many relationship.  Meaning, one sales order has many billing docs. 
    Now, we want to merge the sales order (VBAP) data with billing data (VBRP).  But, we want to take only one billing document which is appropriate.  
    For example, we have a sales order, corresponding that we have a billing debit memo followed by a cancellation, followed by another debit memo.  In this case we have to take the third debit memo as it is the latest and the first one has a cancellation.
    We will know alll this through VA02 Tcode.  However, we want to derive this logic off of the above tables.  We are actaully clue less as to how to pick up the right billing doc from VBRP for a sales order out of many.
    Please post ur replies.
    Thanks.

    Hi Jain,
    Thanks for the reply.  The sort out mechanism may not be the one we are looking for.  There may be several DIFFERENT billing docs for a single sales doc.  More over, these billing docs may have been created on the same date.  So, what we are looking for is a fied or information like XBLNR in VBAP with which we can for sure eliminate all other billing docs and cancellations against them, for exmaple, and pickup the right billing doc alone.
    I relly appreciate your efforts.
    Thanks.

  • Foreign key in many to one relationship causes redunency

    Hi
    suppose I have two tables
    A and B
    Table A has a primary key A_PK number
    Table B has a primary key B_PK number
    The relation between two tables is M to One
    if B_PK is foreign key on table A
    then it causes redunency
    A_PK B_PK
    1 1
    2 1
    so what the best way to solve like this problem?
    thanks

    VANPERSIE wrote:
    Hi
    suppose I have two tables
    A and B
    Table A has a primary key A_PK number
    Table B has a primary key B_PK number
    The relation between two tables is M to One
    if B_PK is foreign key on table A
    then it causes redunency
    A_PK B_PK
    1 1
    2 1
    so what the best way to solve like this problem?
    thanksIt's not sure from your description exactly how/where/what columns are involved in the FK relationship. You either have no problem, or your problem is that you have two tables with the same PK, meaning you haven't normalized your design.
    As suggested, post actual table defs, not just a vague description.

  • Many to one relationship !

    Hi All,
    i have one query having Rental Unit and Measurements.
    in reality one Rental unit has many measurements but when i run the query it shows me only one measurements per Rental Until!
    any clue ? how can i get all the measurements for each rental unit ?
    please help.

    in the cube do you have both of these values
    PT02 211886
    PT02 211887
    or its always either one of them. I dont think changing your cube design would prove any helpful in this scenario. I believe its more of a data issue than the design issue. You would need to change the way the data is entered into the cube with the different measurement assigned to the unit.
    on a second thought(I understand that you dont have a luxury to change the cube design),  when you say you can see diff measurement type assigned to one unit in the masterdata, you can make the unit attribute as a navigational attribute in both the IO and cube. And just map measurent type in the update rules and derive the units from the masterdata table in the report.... does it make sense?
    Message was edited by:
            voodi

  • Many-to-one relationship using annotations in hibernates...

    my pojo class is M_Product_Category
    package com.netree.model;
    import java.io.Serializable;
    import java.util.HashSet;
    import java.util.Set;
    import javax.persistence.CascadeType;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.FetchType;
    import javax.persistence.GeneratedValue;
    import javax.persistence.Id;
    import javax.persistence.Table;
    import javax.persistence.OneToMany;
    import javax.persistence.JoinColumn;
    @Entity
    @Table(name="m_product_category")
    public class M_Product_Category implements Serializable{
         @Id
         @Column(name="MPC_ID")
         @GeneratedValue
         private int mpc_Id;
         @Column(name="IsActive")
         private int isActive;
         @Column(name="Category_Name")
         private String category_Name;
         @Column(name="Category_Description")
         private String category_Description;
         @Column(name="Parent_MPC_ID")
         private int parent_MPC_ID;
         public M_Product_Category(){
         public M_Product_Category(int mpc_Id, int isActive, String category_Name,
                   String category_Description, int parent_MPC_ID) {
              super();
              this.mpc_Id = mpc_Id;
              this.isActive = isActive;
              this.category_Name = category_Name;
              this.category_Description = category_Description;
              this.parent_MPC_ID = parent_MPC_ID;
         public int getMpc_Id() {
              return mpc_Id;
         public void setMpc_Id(int mpc_Id) {
              this.mpc_Id = mpc_Id;
         public int getIsActive() {
              return isActive;
         public void setIsActive(int isActive) {
              this.isActive = isActive;
         public String getCategory_Name() {
              return category_Name;
         public void setCategory_Name(String category_Name) {
              this.category_Name = category_Name;
         public String getCategory_Description() {
              return category_Description;
         public void setCategory_Description(String category_Description) {
              this.category_Description = category_Description;
         @OneToMany(cascade=CascadeType.ALL)
         @JoinColumn(name="Parent_MPC_ID", referencedColumnName="MPC_ID")
         public int getParent_MPC_ID() {
              return parent_MPC_ID;
         public void setParent_MPC_ID(int parent_MPC_ID) {
              this.parent_MPC_ID = parent_MPC_ID;
    This is anothe pojo class i.e., ProductMaster:
    package com.netree.model;
    import java.io.Serializable;
    import javax.persistence.CascadeType;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.Id;
    import javax.persistence.JoinColumn;
    import javax.persistence.ManyToOne;
    import javax.persistence.Table;
    @Entity
    @Table(name = "M_Product_Master")
    public class ProductMaster implements Serializable {
         @Id
         @GeneratedValue
         @Column(name = "MPM_ID")
         private int mpmID;
         @Column(name = "Product_Name")
         private String productName;
         @Column(name = "Product_Description")
         private String productDescription;
         @Column(name = "Standard_Cost")
         private String price;
         @Column(name = "Image_URL_Big")
         private String image;
         @Column(name = "MPC_ID")
         private int mpc_id;
         public int getMpc_id() {
              return mpc_id;
         public void setMpc_id(int mpc_id) {
              this.mpc_id = mpc_id;
         private M_Product_Category product_Category;
         @ManyToOne(cascade = CascadeType.ALL)
         @JoinColumn(name = "mpc_id", referencedColumnName = "MPC_ID")
         public M_Product_Category getProduct_Category() {
              return product_Category;
         public void setProduct_Category(M_Product_Category product_Category) {
              this.product_Category = product_Category;
         public int getMpmID() {
              return mpmID;
         public void setMpmID(int mpmID) {
              this.mpmID = mpmID;
         public String getProductName() {
              return productName;
         public void setProductName(String productName) {
              this.productName = productName;
         public String getProductDescription() {
              return productDescription;
         public void setProductDescription(String productDescription) {
              this.productDescription = productDescription;
         public String getPrice() {
              return price;
         public void setPrice(String price) {
              this.price = price;
         public String getImage() {
              return image;
         public void setImage(String image) {
              this.image = image;
    util class...
    package com.netree.Util;
    import org.hibernate.SessionFactory;
    import org.hibernate.cfg.AnnotationConfiguration;
    public class HibernateUtil {
         public static SessionFactory getSessionFactory() {
              System.out.println("sessionFactory");
              AnnotationConfiguration annotationConfiguration = new AnnotationConfiguration();
              System.out.println("annotationConfiguration");
              annotationConfiguration=annotationConfiguration.configure("com/netree/Cfg/Hibernate.cfg.xml");
              SessionFactory sessionFactory = annotationConfiguration.buildSessionFactory();
              return sessionFactory;
    package com.netree.DaoImpl;
    import java.util.Iterator;
    import java.util.List;
    import org.hibernate.Criteria;
    import org.hibernate.Session;
    import org.hibernate.SessionFactory;
    import org.hibernate.Transaction;
    import org.hibernate.criterion.Restrictions;
    import com.netree.Util.HibernateUtil;
    import com.netree.model.ProductMaster;
    public class ProductMasterImpl {
    public static void main(String args[]) {
                             try{
                                  System.out.println("sessionFactory starts");
              SessionFactory sessionFactory=HibernateUtil.getSessionFactory();
              System.out.println("sessionFactory ends");
              Session session=sessionFactory.getCurrentSession();
                                  Transaction transaction=session.beginTransaction();
         Criteria ctr=session.createCriteria(ProductMaster.class).add(Restrictions.eq("mpc_id",new Integer(39)));
         List<ProductMaster> list=ctr.list();
                   @SuppressWarnings("rawtypes")
                                  Iterator iterator = list.iterator();
                   while (iterator.hasNext()) {
                        ProductMaster productMaster = (ProductMaster) iterator.next();
    System.out.println(productMaster.getMpmID());
    System.out.println(productMaster.getProductName());
    System.out.println(productMaster.getProductDescription());
    System.out.println(productMaster.getPrice());
    System.out.println(productMaster.getImage());
    System.out.println(productMaster.getProduct_Category().getMpc_Id());
    System.out.println(productMaster.getProduct_Category().getCategoryName());
    System.out.println(productMaster.getProduct_Category().getCategory_Description());
                   session.close();
         catch(Exception ex){
         System.out.println(ex.getMessage());
                        finally{
    Already i have two tables in database with the suitable records... I want to retrieve the data by using MPC_ID from both tables....
    when i run this program i am getting query but it is showing exception i.e....
    Hibernate: select this_.MPM_ID as MPM1_1_0_, this_.Image_URL_Big as Image2_1_0_, this_.MPC_ID as MPC3_1_0_, this_.Standard_Cost as Standard4_1_0_, this_.Product_Description as Product5_1_0_, this_.Product_Name as Product6_1_0_, this_.product_Category as product7_1_0_ from M_Product_Master this_ where this_.MPC_ID=?
    could not execute query
    could u pls help me in this regard.....

    in the cube do you have both of these values
    PT02 211886
    PT02 211887
    or its always either one of them. I dont think changing your cube design would prove any helpful in this scenario. I believe its more of a data issue than the design issue. You would need to change the way the data is entered into the cube with the different measurement assigned to the unit.
    on a second thought(I understand that you dont have a luxury to change the cube design),  when you say you can see diff measurement type assigned to one unit in the masterdata, you can make the unit attribute as a navigational attribute in both the IO and cube. And just map measurent type in the update rules and derive the units from the masterdata table in the report.... does it make sense?
    Message was edited by:
            voodi

  • Many-to-One relationship with composed key

    Hi all,
    I have problems inserting an entity with a 1:n-relationship.
    The relationship is defined over two columns. In detail:
    There are two database-tables:
    VERDECK
    ID_PROJECT  NUMBER (key)
    ID_INTERN   VARCHAR2(10 BYTE) (key)
    UZSB
    ID_PROJECT          NUMBER (key)
    ID_UZSB             VARCHAR2(10 BYTE) (key)
    ID_PROJECT_VERDECK  NUMBER
    ID_INTERN_VERDECK   VARCHAR2(10 BYTE)
    On UZSB there is a referential integrity defined between these tables:
    FOREIGN KEY (ID_PROJECT_VERDECK, ID_INTERN_VERDECK)
    REFERENCES R57SCHRAUB.VERDECK (ID_PROJECT,ID_INTERN))
    This is mapped into JPA as follows:
    @Entity
    public class Verdeck implements Serializable {
         @EmbeddedId
         private VerdeckPK pk;
         @OneToMany(cascade={CascadeType.ALL},mappedBy="verdeck")
         private Collection<Uzsb> uzsbCollection;
    @Embeddable
    public class VerdeckPK implements Serializable {
         @Column(name="ID_PROJECT")
         private BigDecimal idProject;
         @Column(name="ID_INTERN")
         private String idIntern;
    @Entity
    public class Uzsb implements Serializable {
         @EmbeddedId
         private UzsbPK pk;
         @ManyToOne
              @JoinColumns({@JoinColumn(name="ID_PROJECT_VERDECK", referencedColumnName="ID_PROJECT"),@JoinColumn(name="ID_INTERN_VERDECK", referencedColumnName="ID_INTERN")})
         private Verdeck verdeck;
    @Embeddable
    public class UzsbPK implements Serializable {
         @Column(name="ID_UZSB")
         private String idUzsb;
         @Column(name="ID_PROJECT")
         private BigDecimal idProject;
    I try inserting a new entity VERDECK with some associated UZSBs as follows:
    Verdeck einVerdeck = new Verdeck();
    VerdeckPK myKey = new VerdeckPK();
    myKey.setIdProject(idProject);
    myKey.setIdIntern(lsId);
    einVerdeck.setPk(myKey);
    Uzsb lsUzsb = new Uzsb();
    UzsbPK lsUzsbKey = new UzsbPK();
    lsUzsbKey.setIdProject(idProject);
    lsUzsbKey.setIdUzsb(lsId);
    lsUzsb.setPk(lsUzsbKey);
    lsUzsb.setVerdeck(einVerdeck);
    Vector<Uzsb> uzsbColl = new Vector<Uzsb>();
    uzsbColl.add(lsUzsb);
    einVerdeck.setUzsbCollection(uzsbColl);
    em.persist(einVerdeck);
    As result I get the error
    "ORA-02291: integrity constraint (R57SCHRAUB.SYS_C0022330) violated - parent key not found"
    Does anybody have an idea? I think the problem could be the embedded key in Verdeck.
    Perhaps I should take this into account in my JPA-definition of the relationship?
    But how can I do this?
    Regards,
    Christoph

    Hi Christoph,
    our JPA implementation does not sort sqlstatements in the right order to work with foreign keys. This feature will come with the next release. The problem here is that databases check the constraint for every statement executed instead of checking at commit time (when our state is ok again).
    As workaround you can set the settings for the foreign key constraints to deferred (pls. see oracle docu: alter table defferrable / alter session deffered) and the database will check at commit time. Second approach would be to delete the foreign key constraints.
    hth
    -Andreas

  • I have had TOPLINK-28018  error afte I had added one-to-many or many-to-one

    Hello.
    I am using TopLink and Spring. I have the followng persistence.xml:
    <persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
    version="1.0">
    <persistence-unit name="registry" transaction-type="RESOURCE_LOCAL">
    <mapping-file>ru/lanit/ps/registry/model/rpaymenttype.xml</mapping-file>
    <mapping-file>ru/lanit/ps/registry/model/radministrativelevel.xml</mapping-file>
    <mapping-file>ru/lanit/ps/registry/model/rterritory.xml</mapping-file>
    <mapping-file>ru/lanit/ps/registry/model/stateowner.xml</mapping-file>
    <properties>
    <property name="com.intellij.javaee.persistence.datasource" value="Datasource"/>
    <property name="toplink.logging.level" value="FINE"/>
    <property name="toplink.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
    <property name="toplink.jdbc.url" value="jdbc:hsqldb:mem:PUBSER"/>
    <property name="toplink.jdbc.password" value=""/>
    <property name="toplink.jdbc.user" value="sa"/>
    </properties>
    </persistence-unit>
    </persistence>
    All my classes are inherited from StateOwner.class and only the RTerritory class has "one-to-many" and "many-to-one" relationships. When I add rterritory.xml to persistence.xml I have the following error (before all works fine):
    log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
    log4j:WARN Please initialize the log4j system properly.
    [TopLink Config]: 2007.12.18 02:47:15.812--ServerSession(25709120)--Thread(Thread[main,5,main])--The column name for element [public java.lang.Long ru.lanit.ps.registry.model.StateOwner.getId()] is being defaulted to: ID.
    [TopLink Config]: 2007.12.18 02:47:15.859--ServerSession(25709120)--Thread(Thread[main,5,main])--The column name for element [public java.lang.Long ru.lanit.ps.registry.model.StateOwner.getStateTerritoryId()] is being defaulted to: STATETERRITORYID.
    [TopLink Config]: 2007.12.18 02:47:15.875--ServerSession(25709120)--Thread(Thread[main,5,main])--The column name for element [public java.lang.String ru.lanit.ps.registry.model.StateOwner.getStringId()] is being defaulted to: STRINGID.
    [TopLink Config]: 2007.12.18 02:47:15.875--ServerSession(25709120)--Thread(Thread[main,5,main])--The column name for element [public java.lang.String ru.lanit.ps.registry.model.StateOwner.getStateStatus()] is being defaulted to: STATESTATUS.
    [TopLink Config]: 2007.12.18 02:47:15.875--ServerSession(25709120)--Thread(Thread[main,5,main])--The column name for element [public java.lang.Long ru.lanit.ps.registry.model.StateOwner.getStateVersion()] is being defaulted to: STATEVERSION.
    [TopLink Config]: 2007.12.18 02:47:15.890--ServerSession(25709120)--Thread(Thread[main,5,main])--The column name for element [public java.lang.String ru.lanit.ps.registry.model.StateOwner.getStateAuthor()] is being defaulted to: STATEAUTHOR.
    [TopLink Config]: 2007.12.18 02:47:15.890--ServerSession(25709120)--Thread(Thread[main,5,main])--The column name for element [public java.sql.Timestamp ru.lanit.ps.registry.model.StateOwner.getStateCreationDate()] is being defaulted to: STATECREATIONDATE.
    [TopLink Config]: 2007.12.18 02:47:15.890--ServerSession(25709120)--Thread(Thread[main,5,main])--The column name for element [public java.sql.Timestamp ru.lanit.ps.registry.model.StateOwner.getStateModificationDate()] is being defaulted to: STATEMODIFICATIONDATE.
    [TopLink Config]: 2007.12.18 02:47:15.890--ServerSession(25709120)--Thread(Thread[main,5,main])--The column name for element [public java.lang.String ru.lanit.ps.registry.model.StateOwner.getStateComment()] is being defaulted to: STATECOMMENT.
    [TopLink Config]: 2007.12.18 02:47:15.906--ServerSession(25709120)--Thread(Thread[main,5,main])--The column name for element [public java.sql.Timestamp ru.lanit.ps.registry.model.StateOwner.getStateProcessedDate()] is being defaulted to: STATEPROCESSEDDATE.
    [TopLink Config]: 2007.12.18 02:47:15.906--ServerSession(25709120)--Thread(Thread[main,5,main])--The discriminator column name for the root inheritance class [class ru.lanit.ps.registry.model.StateOwner] is being defaulted to: DTYPE.
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'GroundOfRefusalServiceTarget' defined in class path resource [groundofrefusal.xml]: Cannot resolve reference to bean 'GroundOfRefusalDao' while setting bean property 'dao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'GroundOfRefusalDao' defined in class path resource [groundofrefusal.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [openJPAsettings.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
    Exception Description: predeploy for PersistenceUnit [registry] failed.
    Internal Exception: java.lang.NullPointerException
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'GroundOfRefusalDao' defined in class path resource [groundofrefusal.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [openJPAsettings.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
    Exception Description: predeploy for PersistenceUnit [registry] failed.
    Internal Exception: java.lang.NullPointerException
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [openJPAsettings.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
    Exception Description: predeploy for PersistenceUnit [registry] failed.
    Internal Exception: java.lang.NullPointerException
    Caused by: javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
    Exception Description: predeploy for PersistenceUnit [registry] failed.
    Internal Exception: java.lang.NullPointerException
         at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:615)
         at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createContainerEntityManagerFactory(EntityManagerFactoryProvider.java:178)
         at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:218)
         at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:251)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1201)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1171)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
         at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
         at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
         at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
         at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
         at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:261)
         at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:109)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1099)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421)
         at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
         at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
         at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
         at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
         at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:261)
         at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:109)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1099)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421)
         at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
         at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
         at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
         at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
         at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
         at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
         at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:91)
         at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:75)
         at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65)
         at ru.lanit.ps.registry.VerifyApplicationContext.setUp(VerifyApplicationContext.java:44)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
         at org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
         at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
         at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
         at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
         at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
         at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
         at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
         at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
         at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
         at com.intellij.rt.junit4.Junit4ClassSuite.run(Junit4ClassSuite.java:78)
         at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
    Caused by: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
    Exception Description: predeploy for PersistenceUnit [registry] failed.
    Internal Exception: java.lang.NullPointerException
         at oracle.toplink.essentials.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:212)
         ... 61 more
    Caused by: java.lang.NullPointerException
         at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.OneToManyAccessor.process(OneToManyAccessor.java:142)
         at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.RelationshipAccessor.processRelationship(RelationshipAccessor.java:275)
         at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProject.processRelationshipDescriptors(MetadataProject.java:564)
         at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProject.process(MetadataProject.java:497)
         at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor.processAnnotations(MetadataProcessor.java:231)
         at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:354)
         at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:584)
         ... 60 more
    Process finished with exit code -1
    This is my RTerritory.class and rterritory.xml
    public class RTerritory extends StateOwner {
    private static final long serialVersionUID = 5372570539234097349L;
    //link to parent
    private RTerritory parentTerritory;
    //title
    private String title;
    //string type
    private String type;
    //Level
    private Integer level;
    //set of children
    private Set<RTerritory> children = new HashSet<RTerritory>(0);
    public RTerritory() {
    public RTerritory(Long RTerritory, String title, String type) {
    setId(RTerritory);
    this.title = title;
    this.type = type;
    public RTerritory(Long id, RTerritory parentTerritory, String title, String type, Integer level) {
    super(id);
    this.parentTerritory = parentTerritory;
    this.title = title;
    this.type = type;
    this.level = level;
    public RTerritory(Long RTerritory, RTerritory parentTerritory, String title,
    String type, Set<RTerritory> RTerritories) {
    setId(RTerritory);
    this.parentTerritory = parentTerritory;
    this.title = title;
    this.type = type;
    this.children = RTerritories;
    public RTerritory(Long id, RTerritory parentTerritory, String title, String type, Integer level, Set<RTerritory> children) {
    super(id);
    this.parentTerritory = parentTerritory;
    this.title = title;
    this.type = type;
    this.level = level;
    this.children = children;
    public Integer getLevel() {
    return level;
    public void setLevel(Integer level) {
    this.level = level;
    public RTerritory getParentTerritory() {
    return this.parentTerritory;
    public void setParentTerritory(RTerritory parent_Territory) {
    this.parentTerritory = parent_Territory;
    public boolean hasParentTerritory() {
         return getParentTerritory() != null;
    public String getTitle() {
    return this.title;
    public void setTitle(String title) {
    this.title = title;
    public String getType() {
    return this.type;
    public void setType(String type) {
    this.type = type;
    public Set<RTerritory> getChildren() {
    return this.children;
    public void setChildren(Set<RTerritory> children) {
    this.children = children;
    public void addChildTerritory(RTerritory territory) throws Exception {
    if (children != null && territory != null) {
    children.add(territory);
    territory.setParentTerritory(this);
    } else {
    throw new Exception("Parameter is null or children is null");// TODO throw exception ?
    public void removeChildTerritory(RTerritory territory) {
    if (children != null && territory != null) {
    children.remove(territory);
    territory.setParentTerritory(null); // TODO territory.setParentTerritory(this.getParentTerritory()) ?
    public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    if (!super.equals(o)) return false;
    RTerritory that = (RTerritory) o;
    if (level != null ? !level.equals(that.level) : that.level != null) return false;
    if (title != null ? !title.equals(that.title) : that.title != null) return false;
    if (type != null ? !type.equals(that.type) : that.type != null) return false;
    return true;
    public int hashCode() {
    int result = super.hashCode();
    result = 31 * result + (title != null ? title.hashCode() : 0);
    result = 31 * result + (type != null ? type.hashCode() : 0);
    result = 31 * result + (level != null ? level.hashCode() : 0);
    return result;
         @Override
         public boolean isReference() {
              return true;
    <?xml version="1.0" encoding="UTF-8"?>
    <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
    version="1.0">
    <package>ru.lanit.ps.registry.model</package>
    <entity class="RTerritory" name="RTerritory">
    <table name="reg_r_territory"/>
    <primary-key-join-column name="R_TERRITORY" referenced-column-name="STATUS_ID"/>
    <attribute-override name="id">
    <column name="R_TERRITORY"/>
    </attribute-override>
    <attributes>
    <basic name="title">
    <column length="256" name="TITLE" nullable="false"/>
    </basic>
    <basic name="type">
    <column length="256" name="TYPE" nullable="false"/>
    </basic>
    <basic name="level">
    <column name="LEVEL"/>
    </basic>
    <!--<many-to-one name="parentTerritory" target-entity="RTerritory">
    <join-column name="PARENT_TERRITORY_ID"/>
    <cascade>
    <cascade-persist/>
    <cascade-merge/>
    <cascade-refresh/>
    </cascade>
    </many-to-one>-->
    <one-to-many name="children" mapped-by="parentTerritory" target-entity="RTerritory">
    <cascade>
    <cascade-all/>
    </cascade>
    </one-to-many>
    <transient name="parentTerritory"/>
    <!--<transient name="children"/>-->
    </attributes>
    </entity>
    </entity-mappings>
    If I make "parentTerritory" and "children" transient - all works well. Above workes also (comment out and without transient) on OpenJpa.
    What do I do wrong if I use TopLink?
    This is part of my applicationContext.xml
    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="persistenceXmlLocation"
    value="/META-INF/persistence.xml"/>
    <property name="jpaVendorAdapter">
    <bean class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter"/>
    </property>
    <property name="loadTimeWeaver">
    <bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/>
    </property>
    </bean
    Thanks a lot.

    Hello.
    Thanks a lot for answer.
    When I comment out and remove transient I obtain the following exception:
    Internal Exception: java.util.NoSuchElementException
         at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:615)
         at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createContainerEntityManagerFactory(EntityManagerFactoryProvider.java:178)
         at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:218)
         at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:251)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1201)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1171)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
         at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
         at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
         at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
         at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
         at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:261)
         at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:109)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1099)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421)
         at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
         at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
         at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
         at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
         at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:261)
         at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:109)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1099)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421)
         at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
         at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
         at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
         at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
         at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
         at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
         at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:91)
         at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:75)
         at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65)
         at ru.lanit.ps.registry.VerifyApplicationContext.setUp(VerifyApplicationContext.java:44)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
         at org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
         at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
         at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
         at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
         at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
         at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
         at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
         at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
         at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
         at com.intellij.rt.junit4.Junit4ClassSuite.run(Junit4ClassSuite.java:78)
         at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
    Caused by: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
    Exception Description: predeploy for PersistenceUnit [registry] failed.
    Internal Exception: java.util.NoSuchElementException
         at oracle.toplink.essentials.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:212)
         ... 61 more
    Caused by: java.util.NoSuchElementException
         at java.util.AbstractList$Itr.next(AbstractList.java:427)
         at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor.getPrimaryKeyFieldName(MetadataDescriptor.java:539)
         at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.ObjectAccessor.processOneToOneForeignKeyRelationship(ObjectAccessor.java:113)
         at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.ObjectAccessor.processOwningMappingKeys(ObjectAccessor.java:190)
         at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.ManyToOneAccessor.process(ManyToOneAccessor.java:106)
         at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.RelationshipAccessor.processRelationship(RelationshipAccessor.java:275)
         at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor.getMappingForAttributeName(MetadataDescriptor.java:486)
         at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.RelationshipAccessor.getOwningMapping(RelationshipAccessor.java:122)
         at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.OneToManyAccessor.process(OneToManyAccessor.java:142)
         at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.RelationshipAccessor.processRelationship(RelationshipAccessor.java:275)
         at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProject.processRelationshipDescriptors(MetadataProject.java:564)
         at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProject.process(MetadataProject.java:497)
         at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor.processAnnotations(MetadataProcessor.java:231)
         at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:354)
         at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:584)
         ... 60 more
    Process finished with exit code -1
    I want to say that exception is same and I don't use GlassFish I run Unit test.
    This is my rterritory.xml now:
    <?xml version="1.0" encoding="UTF-8"?>
    <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
    version="1.0">
    <package>ru.lanit.ps.registry.model</package>
    <entity class="RTerritory" name="RTerritory">
    <table name="reg_r_territory"/>
    <primary-key-join-column name="R_TERRITORY" referenced-column-name="STATUS_ID"/>
    <attribute-override name="id">
    <column name="R_TERRITORY"/>
    </attribute-override>
    <attributes>
    <basic name="title">
    <column length="256" name="TITLE" nullable="false"/>
    </basic>
    <basic name="type">
    <column length="256" name="TYPE" nullable="false"/>
    </basic>
    <basic name="level">
    <column name="LEVEL"/>
    </basic>
    <many-to-one name="parentTerritory" target-entity="RTerritory">
    <join-column name="PARENT_TERRITORY_ID"/>
    <cascade>
    <cascade-persist/>
    <cascade-merge/>
    <cascade-refresh/>
    </cascade>
    </many-to-one>
    <one-to-many name="children" mapped-by="parentTerritory" target-entity="RTerritory">
    <cascade>
    <cascade-all/>
    </cascade>
    </one-to-many>
    <!--<transient name="parentTerritory"/>
    <transient name="children"/>-->
    </attributes>
    </entity>
    </entity-mappings>
    I can't understand What do I do wrong when I include "one-to-many" and "many-to-one" mapping? I want to note it (above mapping) works rightly if I use OpenJpa and one works rightly with TopLink if I remove one-to-many and many-to-one and do them transient.
    Thanks a lot.
    Message was edited by:
    user610937
    Message was edited by:
    user610937

  • Many-to-one synchronization

    I'm using DataServices to manage hiberate objects.  I have a simple many-to-one relationship between Account and Transaction (an account has many transactions).  I have two DataGrids in my application, one display accounts and their balances(which are derived from the trasactions, there is no balance field) the other displays transactions.  When I edit the accounts, the changes are propogated to the child transactions.  However, when I edit the transactions, the changes are not propagated to the accounts automatically.  If I edit the account or resort the columns it will update the balance.  My data-management-config.xml is below.  My question is, is there a way to make this work or is this not working by design?  I want my Account objects to automatically get the new Transactions associated with them so the balance will update correctly.
    <destination id="AccountHibernate">
         <adapter ref="java-dao" />
         <properties>
              <use-transactions>true</use-transactions>
              <source>flex.data.assemblers.HibernateAssembler</source>
              <scope>application</scope>
              <metadata>
                   <identity property="accountId"/>
                   <one-to-many property="transactions" destination="TransactionHibernate" lazy="false" read-only="true" load-on-demand="true"/>  
              </metadata>
              <network>
                   <session-timeout>0</session-timeout>
              </network>
              <server>
                   <hibernate-entity>budget.data.Account</hibernate-entity>
                   <fill-method>
                        <name>fill</name>
                        <params>java.util.List</params>
                   </fill-method>
                   <fill-configuration>
                        <use-query-cache>false</use-query-cache>
                        <allow-hql-queries>true</allow-hql-queries>
                   </fill-configuration>
              </server>
         </properties>
    </destination>
    <destination id="TransactionHibernate">
              <adapter ref="java-dao" />
              <properties>
                   <use-transactions>true</use-transactions>
                   <source>flex.data.assemblers.HibernateAssembler</source>
                   <scope>application</scope>
                   <metadata>
                        <identity property="transactionId"/>
                        <many-to-one property="account"  destination="AccountHibernate" lazy="false" />
                   </metadata>
              <network>
                   <session-timeout>0</session-timeout>
              </network>
              <server>
                   <hibernate-entity>budget.data.Transaction</hibernate-entity>
                   <fill-method>
                        <name>fill</name>
                        <params>java.util.List</params>
                   </fill-method>
                   <fill-configuration>
                        <use-query-cache>false</use-query-cache>
                        <allow-hql-queries>true</allow-hql-queries>
                   </fill-configuration>
              </server>
         </properties>
    </destination>

    Ed: Thanks for your response, I think I have a better idea of what is going
    on now.
    Regarding the first question: In this case I am just modifying an attribute,
    the relationship between them remains the same.
    I verified that adding a transaction does not update the size of the
    transaction collection the account has if I add the new transaction to the
    transactions collection.  However, if I add the transaction to the
    appropriate accounts list of transactions it does update the collection
    (i.e. there is one more element) but it does not update the balance.  I have
    since changed my balance to a property that is calculated by a query server
    side.  I noticed that even if I change a property on the account, it will
    not update the balance unless I call fill again.
    So I have two questions: 1) is there a way to make the account realize it
    has transactions added to it without adding them directly to the account's
    transaction collection?  2) Is there a way to force the account object to
    refresh the balance (i.e. re-run the query to generate it?).  I realize I
    can call fill() again client side and easily fix this, but I would like to
    do this in a way that causes all clients to have their account balances
    refreshed when the should i.e. I want the server to automatically push the
    new balance property.  If it matters I'm using HibernateAssembler.  Could I
    extend that to achieve this?
    Jim

  • Many-to-One user mapping to backend systems - possible?

    My apologies if this simple question has been asked many times earlier - I couldn't find it if it is so.
    I understand I can use user-mapping in single signon to map user X in portal to user A in backend system (say SAP BI).
    Can I map users X, Y, Z..... to one backend user A?
    What alternative I have (to let a number of portal users run some BW reports on the backend system - for which we want to use only one BI user-id)?

    An easier more manageble way of doing this is to create a group and assign the group to a backend user. That will establish your many to one relationship.
    We perform this for our vendors currently as they would like to see a single shopping cart in SRM.
    Just be cautious on the manner in which you leverage your single user as you can experience several locked objects depending on how things are accessed. Another thing to consider is making the backend user a service user as this will also allow you to change the password mapping policies on the users as in many cases you will need to remap the users every N days depending on your systems security parameters.
    Hope this helps.

  • Select with One-to-Many and Many-to-One without repeating

    Hi
    I have a customer who needs a report two sides left and right, but allowing for One-to-Many and Many-to-One relationships in the one report.
    A little background:-
    This has do do with listings on land and buildings.
    One building can be built on a few pieces of land.
    Similarly, there can be several buildings on one piece of land.
    What is required is a listing of buildings on the left, land on the right, but without repeating the "single line entries" either left or right.
    For example Building1 is on Land1 and Land2, and Building2 and Building3 are built on Land3.
    We need:-
    Building1 Land1
    ________Land2
    Building2 Land3
    Building3______
    The ___ just used for spacing so you get the idea ;)
    Essentially - a "break by" on columns on the left and right.
    The Buildings and Land are in different tables, with a link table - one row for each link.
    Any ideas?
    Thanks
    Mike

    To jitu.jk - first, this is not in SQL*Plus - its a report in APEX - second, I see no way to break on the left and the right in the same select.
    Maybe there is a way.
    To Etbin
    This is a very inovative solution - I've tried it out and the result is:-
    BUILDING LAND
    _____Land 4
    _____Land 3
    _____Land 5
    Building 2 Land 4
    Building 3 Land 1
    _____Land 4
    Building 4 Land 4
    Building 5 Land 3
    _____Land 4
    (The underscores I put in for spacing - not perfect but you get the idea - hard whe you write the reply in a fixed space font and it's displayed in the forum in variable space font!! ;)
    9 rows selected.
    This is not quite the desired result - in your list of associations, we have Building1 associated with Land 3,4, and 5.
    So for Building 1 we should have:-
    Building 1 Land 3
    ________Land 4
    ________Land 5..........
    But your result doesn't include Building 1 at all.
    The other requirement is that no building or land is ever repeated - so I came up with the concept of "groups".
    Starting with one building - I find all pieces of land that are associated - listing them on the right (without repeating the building.
    I then find any other buildings asociated with any of the land records that the first building was associated with.
    These are listed on the left - without repeating the land records on the right.
    This group is given a unique identifier of the minimum association ID (my associations have ID's).
    This all done, I use the unique ID as a break column ans summarise additional columns (area, value etc) below each group.
    Because of the summaries - adding area and value etc, I can't have any building or land duplicated as I would then "double count" the area, value etc.
    Maybe you method can be made to work with some tweaking.
    Very clever indeed - forums need great answers like this - it keeps us going.
    Thanks again
    Mike

  • SSAS - Many to Many Relationship Grain Filters Out Data (Many to One)

    I have a simple Many to One example: One Fact Table record has many Dimensional Items.  The Example I'm using is One FactEvent record can have multiple EventMembers.  These members are always unique so the relationship is really many to one (vs.
    many to many). The grain of the Fact is one row for every event.  Not all events have members, but I have stubbed those with -1
    I tried using a Referenced dimensional relationship, but it threw my total counts off.  I decided to make it more complicated by using a
    Many to Many relationship, but I had issues once I started slicing the data.
    The following are my two very simple tables:
    FactEvents:
    EventMemberID MemberKey EventMemberKey MemberName MemberGender
    1             1         -1             None       N          
    2             2         E2             Tyler      M          
    3             3         E2             John       M          
    4             4         E2             Sue        F          
    5             5         E5             Tim        M          
    6             6         E5             Jane       F          
    7             7         E12            Ashley     F          
    8             8         E12            Jessica    F          
    9             9         E12            Kristy     F          
    10            10        E17            Mike       M          
    11            11        E17            Josh       M          
    12            12        E18            Warren     M          
    13            13        E18            Eric       M           
    Here is the bridge Table:
    EventID EventBK EventName         EventMemberKey EventCount
    1       E1      Hockey Game       -1             1          
    2       E2      Soccer Game       E2             1          
    3       E3      Baseball Game     -1             1          
    4       E4      Concert           -1             1        
    5       E5      Food Festival     E5             1          
    6       E6      Movie Night       -1             1          
    7       E7      Data Group Event  -1             1          
    8       E8      City Tour         -1             1          
    9       E9      Ski Trip          -1             1        
    10      E10     Camping Trip      -1             1          
    11      E11     Hiking Trip       -1             1          
    12      E12     Community Cleanup E12            1          
    13      E13     Block Party       -1             1          
    14      E14     Toastmasters      -1             1          
    15      E15     Train Spotting    -1             1          
    16      E16     Plane Spotting    -1             1          
    17      E17     Fishing Trip      E17            1          
    18      E18     Hunting Trip      E18            1          
    19      E19     Street Hockey     -1             1          
    20      E20     Bonspiel          -1             1          
    You can see many events have no members and some events have multiple members.  There is not separate members Dim, just the bridge table.  I tried to build view that would work as bridge tables, but it started to feel like overkill.
    Here is the SSAS structure:
    Cube:
    I tried creating a bridge Dim and Measure Group that can be used to join FactEvents with DimMemberEvent:
    When I query the database tables directly, I can get the structure I'm looking for:
    Gender  Count
    F            5
    M           7
    N           15
    This represents that although there are 20 events, there were 5 Female and 7 Male participants and 15 events with No participants.  When looking at the cube in excel I get:
    Gender  Count
    F            3
    M           4
    N           15
    Grand Total 20
    The grand total is correct, however, it looks like it is grouping the events, so if there are multiple Female members at a particular event, they get rolled up.  You can see this better if I pull in member name:
    It includes all the names with count 1 ie. 5 Females with count 1, but the gender subtotal is 3 (as it is grouping the gender dimension)
    The detail member counts are good, but the rolled up M and F counts are stripping out duplicates.  Is there a way to model this in SSAS to preserve the detail member counts when the member dimension is used?  Is a many to many the best solution?
    This is all using SQL Server 2012 Multi-Dimensional Model. Thanks.

    Ok, for starters, if it's a one to many relationship, don't set it up as a many to many!  Avoid many to many relationships and really anything other than "regular" relationships. 
    Second, the tables you pasted the data for aren't the tables you are describing them as, based on the dsv screenshot you included.  If your post is confusing to the people who are wanting to help you, they will quickly move on.
    It seems that you are not clear on how to construct a star schema.  I will lay one out for you and hopefully this can help you on your journey.
    fact_member_event:
    event_id
    member_id
    member_event_count
    dim_member:
    member_id
    member_key
    member_name
    member_gender
    dim_event:
    event_id
    event_name
    fact_event:
    event_id
    event_count
    Or alternately, you could drop the fact_event fact table and have a calculated member that uses dimEvent.event.event.allmembers.count.  It's a little bit of a weird situation that I would want to play with, but I would start with the above.  
    Also if you post back and show query results, you should make it clear what columns  you are displaying.  I see "count" in your query above, but nowhere in the star schema do I see "member count"
    as a field.. I guess that's event count?
    Hope this helps,
    Ken

  • Strange behavior when "trying" to burn a disk.

    At least I think this is strange behavior, following the instructions in the help viewer, topic "Backing up your music to a CD or DVD." One thing for sure, it's not burning a disc and it ain't telling me why.
    I select the playlist and click "Burn Disc"
    Requests a blank disc. I insert one.
    Message "checking media"
    after about a minute, the disc ejects
    Message "checking media" displays another 30 seconds
    No other messages displayed.
    What the ??? Shouldn't it at least display an error message??
    Super-Drive information..... from System Profiler
    MATSHITA DVD-R UJ-845C:
    Firmware Revision: DPP9
    Interconnect: ATAPI
    Burn Support: Yes (Apple Shipped/Supported)
    Cache: 2048 KB
    Reads DVD: Yes
    CD-Write: -R, -RW
    DVD-Write: -R, -RW, +R, +RW
    Burn Underrun Protection CD: Yes
    Burn Underrun Protection DVD: Yes
    Write Strategies: CD-TAO, CD-SAO, DVD-DAO
    Media: No
    Using Sony DVD+R discs.
    Mac Mini   Mac OS X (10.4.8)  

    Whoops, sorry, this was while burning a playlist.
    I've also tried some Pleomax CD disks (Samsung), with no luck. I've tried burning directly from iTunes, and from Toast 7.
    Of the types I've tried, the Sony DVD's have been the best for me. Haven't tried many types though. Maybe I can get disks one at a time until I find a brand my burner likes.
    Still, isn't it strange that there is NO error message? It just quits?
    Mac Mini   Mac OS X (10.4.8)  

  • Strange behavior - icon thumbnail instead of image - CC@OSX10.10

    Hi,
    my CC (@OS X 10.10.3) showing a strange behavior using vanishing point filter.
    After defining grid and try to paste the image OS X paste the icon thumbnail instead of the image,
    Many thanks in advance!!
    br
    Joachim

    It is probably related to the fact that you are setting the tables row height in the renderer this will fire a render message when the height changes. One height is applied to all rows of a table. This means that is you have images of different heights you are continually changing the tables row height and therefore continually rendereing.
    My approach would be to have all the images fit into a set size ( say 64*64 ( with scaling if neccesary ) you could then have a popup show the full size image if required.

  • Strange behavior from a PB G4 (Part 2)

    On to my next issue. Often when I'm typing the insertion point will jump to someplace other than where it should be or just disappear all together. I'm not doing anything to cause it to do this. I've been being really carefull to not to do anything wrong. I'ts often enough to be a real nuisance. It happened 7 times during my first post (Strange behavior from a PB G4) and 3 times during this one. Please help. Thanks.

    Igor_G5 wrote:
    ... I thought about putting in a larger drive but when I looked up instructions for it i was surprized at how difficult it was.
    Did you use the iFixit website? It has excellent pictures and instructions that are easy to follow.
    Replacing any hard disk drive will be challenging for a paraplegic, but with someone's help it can be done fairly inexpensively. There are many tiny fasteners that require tiny tools. Use an egg carton to store them, separated by their location in the PowerBook.
    Earlier PowerBooks are easier to work on than later ones.
    I still use a PowerBook G4 on occasion, mostly for importing video for editing in iMovie. I upgraded its original 60 GB HD to a much larger one. If you were to do this you would need to locate the PowerBook's original System Install DVD to install and subsequently update OS X and all its original programs.
    If you ensure at least a few gigabytes free space, I think most of your problems will be fixed. When free disk space gets down to a few hundred megabytes or less, performance will suffer dramatically. You don't want it to ever get anywhere near that low. Strange things start to happen.
    Keep the number of icons on the Desktop to a minimum also. That makes a difference, for reasons that I do not fully understand.

Maybe you are looking for