WCF RIA zero-one to many ultimate treeview

Hi,
I am using ultimate treeview extension (http://visualstudiogallery.msdn.microsoft.com/ca292c74-661c-48ba-8262-d79a2671c33f)
This requires a zero-one to many table. I have this working with a table.
However I need to connect to a WCF RIA service from the control. Currently using 
 public class WorksOrderTree
        [Key()]
        public int id { get; set; }
        [Association("ProductPart", "id", "ParentID")]
        public IEnumerable<WorksOrderTree> Children { get; set; }
        [Association("ProductPart", "ParentID", "id", IsForeignKey = true)]
        public WorksOrderTree Parent { get; set; }
        public int ParentID { get; set; }
This gives the following error
Error 1
f0rmoum1..csdl(26,6) : error 0113: Multiplicity is not valid in Role 'WorksOrderTree' in relationship 'ProductPart'. Because all the properties in the Dependent Role are nullable, multiplicity of the Principal Role must be '0..1'.
Any idea to to how create zero-one to many in the ria service.
Thanks
Steve

Thanks for your reply Paul.
Yes I read your blog about the Telerik treeview and it was very helpful. the problem is that I want to use the Telerik RadTreeListView control instead, and It seem that it cannot be used with LightSwitch (for threading problems...)
So I am obliged to create a RIAService ( that I hope) it can return a hierarchical structure without any lazy loading, so the RadTreeListView can work....
but It seem that RIAService (Or LightSwitch) Insists on lazy load, and I don't know how to avoid it...
I know that I can create a service in my UserControl project as you say in your blog but I am trying to create a LightSwitch extention ....
AAK

Similar Messages

  • How Can realize a one-to-many relationship via RIA service in lightswitch

    I have to query a large data and the normal query in lightswitch is so slow that I decided to use RIA service to improve the query.However I am not very good at RIA service. I follow
    this tutorial and set up a very simple RIA service. In my project, I have a one-to-many relationship but I don't know how to
    realize it . here is the Relationship:
    public class CombinedStadium
    private EcoStatus _ecoStatus;
    [Key]
    public int Id { get; set; }
    public string Name { get; set; }
    public string Category { get; set; }
    public string Owner { get; set; }
    public string Street { get; set; }
    public string OrgCode { get; set; }
    public string Place { get; set; }
    public int? FoundYear { get; set; }
    public double? LandArea { get; set; }
    public double? BuildingArea { get; set; }
    public double? SiteArea { get; set; }
    public double? Investment { get; set; }
    public double? Fiscal { get; set; }
    public double? CommonWeal { get; set; }
    public double? SelfRaised { get; set; }
    public double? SocialDonate { get; set; }
    public double? Other { get; set; }
    public double? Longitude { get; set; }
    public double? Latitude { get; set; }
    public string Note { get; set; }
    public byte[] Photo { get; set; }
    [Include]
    [Association("Stadium_EcoStatus", "Id", "EcoId", IsForeignKey = false)]
    public virtual EcoStatus EcoStatus
    get { return this._ecoStatus; }
    set
    this._ecoStatus = value;
    if (value == null)
    this.Id = value.Id;
    I am not sure whether it is right or not. But I want "one CombinedStadium Entity may contains
    more than one(many)EcoStatus Entities.
    I tried the code above and update my datasource, I got the error "the entity
    LightSwitchApplication.Implementation.EcoStatus's property doesn't supported by the type of StadiumEcoReference".
    How Can I realize a one-to-many relationship via RIA and use it in my lightswitch program?
    thx !!!

    namespace WCF_RIA_Project
    public class CombinedStadium
    [Key]
    public int SiteId { get; set; }
    public string Name { get; set; }
    public string Category { get; set; }
    public string Owner { get; set; }
    public string Street { get; set; }
    public string OrgCode { get; set; }
    public string Place { get; set; }
    public int? FoundYear { get; set; }
    public double? LandArea { get; set; }
    public double? BuildingArea { get; set; }
    public double? SiteArea { get; set; }
    public double? Investment { get; set; }
    public double? Fiscal { get; set; }
    public double? CommonWeal { get; set; }
    public double? SelfRaised { get; set; }
    public double? SocialDonate { get; set; }
    public double? Other { get; set; }
    public double? Longitude { get; set; }
    public double? Latitude { get; set; }
    public string Note { get; set; }
    public byte[] Photo { get; set; }
    [Include]
    [Association("Stadium_EcoStatus", "SiteId", "StadiumId")]
    public IQueryable<CombindeEcoStatus> EcoStatus { get; set; }
    public class CombindeEcoStatus
    [Key]
    public int EcoId { get; set; }
    public string StatdiumName { get; set; }
    public int? StadiumId { get; set; }
    public int? Year { get; set; }
    public int? EmployeeNum { get; set; }
    public string OperateMode { get; set; }
    public string OpenStatus { get; set; }
    public double? OpeningDays { get; set; }
    public string ClientCount { get; set; }
    public double? Income { get; set; }
    public double? Expend { get; set; }
    [Include]
    [Association("Stadium_EcoStatus", "StadiumId", "SiteId", IsForeignKey = true)]
    public CombinedStadium Stadium
    get;
    set;
    public class WCF_RIA_Service : DomainService
    private ApplicationData m_context;
    public ApplicationData Context
    get
    if (this.m_context == null)
    string connString =
    System.Web.Configuration.WebConfigurationManager
    .ConnectionStrings["_IntrinsicData"].ConnectionString;
    EntityConnectionStringBuilder builder = new EntityConnectionStringBuilder();
    builder.Metadata =
    "res://*/ApplicationData.csdl|res://*/ApplicationData.ssdl|res://*/ApplicationData.msl";
    builder.Provider =
    "System.Data.SqlClient";
    builder.ProviderConnectionString = connString;
    this.m_context = new ApplicationData(builder.ConnectionString);
    return this.m_context;
    [Query(IsDefault = true)]
    public IQueryable<CombinedStadium> GetAllStadiums()
    var stadiumsQuery = from stadium in this.Context.StadiumSet
    select new
    ID = stadium.Id,
    Name = stadium.Name,
    Category = stadium.Category.Name,
    OwnerParts = stadium.Owner2StadiumMediatorCollection.Select(x => x.Owner.Name),
    Street = stadium.Street.Name,
    OrgCode = stadium.StadiumBase.OrgCode,
    Place = stadium.StadiumBase.Place,
    FoundYear = stadium.StadiumBase.FoundYear,
    LandArea = stadium.StadiumBase.LandArea,
    BuildingArea = stadium.StadiumBase.BuildingArea,
    SiteArea = stadium.StadiumBase.SiteArea,
    Investment = stadium.StadiumBase.Investment,
    Fiscal = stadium.StadiumBase.Fiscal,
    CommonWeal = stadium.StadiumBase.CommonWeal,
    SelfRaised = stadium.StadiumBase.SelfRaised,
    SocialDonate = stadium.StadiumBase.SocialDonate,
    Other = stadium.StadiumBase.Other,
    Longitude = stadium.StadiumBase.Longitude,
    Latitude = stadium.StadiumBase.Latitude,
    Note = stadium.StadiumBase.Note,
    Photo = stadium.StadiumBase.Photo,
    var result = stadiumsQuery.AsEnumerable().Select(x => new CombinedStadium()
    SiteId = x.ID,
    Name = x.Name,
    Category = x.Category,
    Owner = string.Join("/", x.OwnerParts),
    Street = x.Street,
    OrgCode = x.OrgCode,
    Place = x.Place,
    FoundYear = x.FoundYear,
    LandArea = x.LandArea,
    BuildingArea = x.BuildingArea,
    SiteArea = x.SiteArea,
    Investment = x.Investment,
    Fiscal = x.Fiscal,
    CommonWeal = x.CommonWeal,
    SelfRaised = x.SelfRaised,
    Other = x.Other,
    Longitude = x.Longitude,
    Latitude = x.Latitude,
    Note = x.Note,
    Photo = x.Photo,
    }).AsQueryable();
    return result;
    [Query(IsDefault = true)]
    public IQueryable<CombindeEcoStatus> GetAllEcoStatuses()
    var stadiumEco = from eco in this.Context.EcoStatusSet
    select new CombindeEcoStatus()
    EcoId = eco.Id,
    StatdiumName = eco.StadiumEco.Name,
    StadiumId = eco.StadiumEco.Id,
    Year = eco.Year,
    EmployeeNum = eco.Employee,
    OperateMode = eco.OperateMode,
    OpenStatus = eco.OpenStatus,
    OpeningDays = eco.OpeningDays,
    ClientCount = eco.ClientCount,
    Income = eco.Income,
    Expend = eco.Expend
    return stadiumEco;
    protected override int Count<T>(IQueryable<T> queryable)
    return queryable.Count();
    now I have solved my problem, but when I query the data in Lihgtswitch HTMLClient . I can't get the related entities "CombindeEcoStatus" . How can I write the return value of
    GetAllStadiums function to get the related CombindeEcoStatus of each
    CombinedStadium?
    thanks!

  • Confused with one to many relationship

    Hi Masters ,
    Reading about one to many : i came across this
    Each row in Table A can have many (zero or more)
    matching rows in Table B but each row in Table B
    has only one matching row in Table A.
    A ZipCode can have many Students but each Student has only
    one ZipCode
    Theoritically this would be fine but can anyone please make tables for the above so i want to see it pratical work.

    zip
    (zipcode varchar2(6)
    , low_street_number varchar2(10)
    , high_street_number varchar2(10)
    , odd_even char(1)
    , city varchar2(30)
    , constraint zip_pk primary key (zipcode)
    student
    (studentno number(10)
    , firstname varchar2(30)
    , lastname varchar2(30)
    , zipcode varchar2(6)
    , constraint zip_fk foreign key(zipcode) references zip_pk
    Sybrand Bakker
    Senior Oracle DBA

  • One to many mappings and combination generation

    Please help folks,
    I want to perform one to many mapping i.e a single row of data will be taken from a single table Table 'A' into Hashtable A and it has to be matched with 'n' number of rows from another table Table 'B' taken into Hashtable B. The no. of rows selected from B can be 1/2.... upto n. For performing this mapping iam using a Combination Generator Code which will Key nos. to be selected for checking whether they can be mapped and then further processing is done on these key nos. returned by the combination generator. The code for combination generator is given below.
    The issue is say if there are about 50 rows in table B then no of combinations possible are 2 ^ 50, which is just too much for the PC to handle i.e the code takes about 4-5 days of processing time. 256 MB RAM, P4. The mapping has to be done in 30 minutes!!!! Ne ideas folks????
    // Systematically generate combinations.
    import java.math.BigInteger;
    public class CombinationGenerator {
    private int[] a;
    private int n;
    private int r;
    private BigInteger numLeft;
    private BigInteger total;
    // Constructor
    public static void main(String[] args)
    String[] elements = {"a", "b", "c", "d", "e", "f", "g"};
    int[] indices;
    CombinationGenerator x = new CombinationGenerator (elements.length, 3);
    StringBuffer combination;
    while (x.hasMore ()) {
    combination = new StringBuffer ();
    indices = x.getNext ();
    for (int i = 0; i < indices.length; i++) {
    combination.append (elements[indices[i]]);
    System.out.println (combination.toString ());
    public CombinationGenerator (int n, int r) {
    if (r > n) {
    throw new IllegalArgumentException ();
    if (n < 1) {
    throw new IllegalArgumentException ();
    this.n = n;
    this.r = r;
    a = new int[r];
    BigInteger nFact = getFactorial (n);
    BigInteger rFact = getFactorial (r);
    BigInteger nminusrFact = getFactorial (n - r);
    total = nFact.divide (rFact.multiply (nminusrFact));
    reset ();
    // Reset
    public void reset () {
    for (int i = 0; i < a.length; i++) {
    a[i] = i;
    numLeft = new BigInteger (total.toString ());
    // Return number of combinations not yet generated
    public BigInteger getNumLeft () {
    return numLeft;
    // Are there more combinations?
    public boolean hasMore () {
    return numLeft.compareTo (BigInteger.ZERO) == 1;
    // Return total number of combinations
    public BigInteger getTotal () {
    return total;
    // Compute factorial
    private static BigInteger getFactorial (int n) {
    BigInteger fact = BigInteger.ONE;
    for (int i = n; i > 1; i--) {
    fact = fact.multiply (new BigInteger (Integer.toString (i)));
    return fact;
    // Generate next combination (algorithm from Rosen p. 286)
    public int[] getNext () {
    if (numLeft.equals (total)) {
    numLeft = numLeft.subtract (BigInteger.ONE);
    return a;
    int i = r - 1;
    while (a[i] == n - r + i) {
    i--;
    System.out.println("inside while");
    a[i] = a[i] + 1;
    for (int j = i + 1; j < r; j++) {
    a[j] = a[i] + j - i;
    numLeft = numLeft.subtract (BigInteger.ONE);
    return a;

    Next time you post, see the formatting guidelines [url http://forum.java.sun.com/features.jsp#Formatting]here. //--------------------------------------
    // Systematically generate combinations.
    import java.math.BigInteger;
    public class CombinationGenerator {
    private int[] a;
    private int n;
    private int r;
    private BigInteger numLeft;
    private BigInteger total;
    // Constructor
    public static void main(String[] args)
    String[] elements = {"a", "b", "c", "d", "e", "f", "g"};
    int[] indices;
    CombinationGenerator x = new CombinationGenerator (elements.length, 3);
    StringBuffer combination;
    while (x.hasMore ()) {
    combination = new StringBuffer ();
    indices = x.getNext ();
    for (int i = 0; i < indices.length; i++) {
    combination.append (elements[indices]);
    System.out.println (combination.toString ());
    public CombinationGenerator (int n, int r) {
    if (r > n) {
    throw new IllegalArgumentException ();
    if (n < 1) {
    throw new IllegalArgumentException ();
    this.n = n;
    this.r = r;
    a = new int[r];
    BigInteger nFact = getFactorial (n);
    BigInteger rFact = getFactorial (r);
    BigInteger nminusrFact = getFactorial (n - r);
    total = nFact.divide (rFact.multiply (nminusrFact));
    reset ();
    // Reset
    public void reset () {
    for (int i = 0; i < a.length; i++) {
    a = i;
    numLeft = new BigInteger (total.toString ());
    // Return number of combinations not yet generated
    public BigInteger getNumLeft () {
    return numLeft;
    // Are there more combinations?
    public boolean hasMore () {
    return numLeft.compareTo (BigInteger.ZERO) == 1;
    // Return total number of combinations
    public BigInteger getTotal () {
    return total;
    // Compute factorial
    private static BigInteger getFactorial (int n) {
    BigInteger fact = BigInteger.ONE;
    for (int i = n; i > 1; i--) {
    fact = fact.multiply (new BigInteger (Integer.toString (i)));
    return fact;
    // Generate next combination (algorithm from Rosen p. 286)
    public int[] getNext () {
    if (numLeft.equals (total)) {
    numLeft = numLeft.subtract (BigInteger.ONE);
    return a;
    int i = r - 1;
    while (a == n - r + i) {
    i--;
    System.out.println("inside while");
    a = a + 1;
    for (int j = i + 1; j < r; j++) {
    a[j] = a + j - i;
    numLeft = numLeft.subtract (BigInteger.ONE);
    return a;
    }

  • Sorting on one-to-many relationship with JPA criteria API

    I'm having some trouble using JPA criteria API with collection references.
    I have an entity called Competence that has a one-to-many relation to CompetenceName that contains names for Competence for several languages.
    [Competence.java]
    @OneToMany(mappedBy="competence", cascade=CascadeType.ALL, orphanRemoval=true)
    private List<CompetenceName> competenceNames;
    [CompetenceName.java]
    @ManyToOne @JoinColumn(name = "competence_id", referencedColumnName = "id")
    private Competence competence;
    @ManyToOne @JoinColumn(name = "lang_id", referencedColumnName = "id")
    private Language language;
    @Basic @Column(name = "name", length = 50)
    private String name
    Now I want to load 200 Competence-entities and sort them by their name (depending on the language of the logged in user). How would this be done using the JPA Criteria API? With a normal query, I would accomplish this with
    "SELECT DISTINCT c FROM Competence AS c LEFT JOIN c.competenceNames AS cn ORDER BY cn.name"
    Obviously, CompetenceName could contain zero entries for a Competence, but it works anyway with a normal query. With criteria API, it would look something like:
    CriteriaQuery<Competence> cq = cb.createQuery(Competence.class);
    Root<Competence> competence = cq.from(Competence.class);
    competence.fetch(Competence_.competenceNames);
    cq.select(competence).orderBy(cb.asc(competence.get(Competence_.competenceNames).get(CompetenceName_.name)); // Doesn't work
    Is this even possible to do without creating a normal query?
    Edited by: 812655 on Nov 24, 2010 2:32 AM

    // Doesn't workWhat does not work? What error do you get?
    You need to use "join" to define a join.
    CriteriaQuery<Competence> cq = cb.createQuery(Competence.class);
    Root<Competence> competence = cq.from(Competence.class);
    Join<CompetenceName> name = competence.join(Competence_.competenceNames);
    cq.orderBy(cb.asc(name.get(CompetenceName_.name));
    The "fetch" will do a fetch join, if you also wish to load the data in the same query.
    James : http://www.eclipselink.org

  • SELECT on One to many Relationship

    Hi am trying to run a select statement  on one to many relationship.
    TableA is the main table with acount number and Total_Payments
    TableB,TableC and TableD have  a lot of account number and payments
    per day
    Note an account might on TableA might not be on TableB or TableC since it was not paid for that day hence 'if it is Null i'll like to populate a zero.
    OUTPUT should be :
                                      TableA.Account_No | Total_Amount(amounts from TableB/C/D)
    Regards.

    Hello,
    Please refer to the following statements. If I have any misunderstand, please post the DDL of the tables and sample data for further analysis:
    SELECT A.account, SUM(ISNULL(B.payment,0)+ISNULL(C.payment,0)+ISNULL(D.payment,0)) As Total_Amounts
    FROM TableA A LEFT JOIN TableB B ON A.account=B.account
    LEFT JOIN TableC C ON A.account=C.account
    LEFT JOIN TableD D ON A.account=D.account
    GROUP BY A.Account
    Regards,
    Fanny Liu
    If you have any feedback on our support, please click here. 
    Fanny Liu
    TechNet Community Support

  • Unable to read one-to-many relations using Hibernate

    Hi,
    I am trying with a very simple one-to-many relationship. When I am storing the objects, there are no problems. But when I am trying to read out the collection, it says invalid descriptor index. Please help.
    Regards,
    Hibernate version:
    hibernate-3.1rc2
    Mapping documents:
    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <hibernate-mapping>
         <class name="Parent">
              <id name="id">
                   <generator class="identity"/>
              </id>
              <set name="children">
                   <key column="parent_id"/>
                   <one-to-many class="Child"/>
              </set>
         </class>
         <class name="Child">
              <id name="id">
                   <generator class="identity"/>
              </id>
              <property name="name"/>
         </class>
    </hibernate-mapping>
    Code between sessionFactory.openSession() and session.close():
    The Parent class:
    public class Parent
         private Long id ;     
         private Set children;
         Parent(){}
         public Long getId()
              return id;
         public void setId(Long id)
              this.id=id;
         public Set getChildren()
              return children;
         public void setChildren(Set children)
              this.children=children;
    The Child class:
    public class Child
         private Long id;
         private String name;
         Child(){}
         public Long getId()
              return id;
         private void setId(Long id)
              this.id=id;
         public String getName()
              return name;
         public void setName(String name)
              this.name=name;
    The Main class:
    public class PCManager
         public static void main(String[] args)
              PCManager mgr = new PCManager();
              List lt = null;
              if (args[0].equals("store"))
                   mgr.createAndStoreParent(new HashSet(3));
              else if (args[0].equals("list"))
                   mgr.listEvents();
              HibernateUtil.getSessionFactory().close();
         private void createAndStoreParent(HashSet s)
              HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();
              Parent p1 = new Parent();
              int size = 3;
              for (int i=size; i>0; i--)
                   Child c = new Child();
                   c.setName("Child"+i);
                   s.add(c);
              p1.setChildren (s);
              Iterator elems = s.iterator();
              do {     
                   Child ch = (Child) elems.next();
                   HibernateUtil.getSessionFactory().getCurrentSession().save(ch);
              }while(elems.hasNext());
              HibernateUtil.getSessionFactory().getCurrentSession().save(p1);
              HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().commit();
         private void listEvents()
              HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();
              Parent result = (Parent) HibernateUtil.getSessionFactory().getCurrentSession().load(Parent.class, new Long(1));
              System.out.println("Id is :"+ result.getId());
              Set children = result.getChildren();
              Iterator elems = children.iterator();
              do {     
                   Child ch = (Child) elems.next();
                   System.out.println("Child Name"+ ch.getName());
              }while(elems.hasNext());
              HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().commit();          
    Full stack trace of any exception that occurs:
    When I run with "hbm2ddl.auto" property as validate and trying to list the contents, I get the following out put.
    C:\Documents and Settings\mirza\Desktop\hibernate-3.1rc2\MyHibernate>ant run -Da
    ction=list
    Buildfile: build.xml
    clean:
    [delete] Deleting directory C:\Documents and Settings\mirza\Desktop\hibernate
    -3.1rc2\MyHibernate\bin
    [mkdir] Created dir: C:\Documents and Settings\mirza\Desktop\hibernate-3.1rc
    2\MyHibernate\bin
    copy-resources:
    [copy] Copying 4 files to C:\Documents and Settings\mirza\Desktop\hibernate
    -3.1rc2\MyHibernate\bin
    compile:
    [javac] Compiling 5 source files to C:\Documents and Settings\mirza\Desktop\
    hibernate-3.1rc2\MyHibernate\bin
    run:
    [java] 09:09:23,433 INFO Environment:474 - Hibernate 3.1 rc2
    [java] 09:09:23,449 INFO Environment:489 - loaded properties from resource
    hibernate.properties: {hibernate.cglib.use_reflection_optimizer=true, hibernate
    .cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.dial
    ect=org.hibernate.dialect.SQLServerDialect, hibernate.max_fetch_depth=1, hiberna
    te.jdbc.use_streams_for_binary=true, hibernate.format_sql=true, hibernate.query.
    substitutions=yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.cac
    he.region_prefix=hibernate.test, hibernate.jdbc.batch_versioned_data=true, hiber
    nate.connection.pool_size=1}
    [java] 09:09:23,465 INFO Environment:519 - using java.io streams to persis
    t binary types
    [java] 09:09:23,465 INFO Environment:520 - using CGLIB reflection optimize
    r
    [java] 09:09:23,481 INFO Environment:550 - using JDK 1.4 java.sql.Timestam
    p handling
    [java] 09:09:23,559 INFO Configuration:1257 - configuring from resource: /
    hibernate.cfg.xml
    [java] 09:09:23,559 INFO Configuration:1234 - Configuration resource: /hib
    ernate.cfg.xml
    [java] 09:09:23,872 INFO Configuration:460 - Reading mappings from resourc
    e: PCMapping.hbm.xml
    [java] 09:09:24,013 INFO HbmBinder:266 - Mapping class: Parent -> Parent
    [java] 09:09:24,045 INFO HbmBinder:266 - Mapping class: Child -> Child
    [java] 09:09:24,045 INFO Configuration:1368 - Configured SessionFactory: n
    ull
    [java] 09:09:24,061 INFO Configuration:1014 - processing extends queue
    [java] 09:09:24,061 INFO Configuration:1018 - processing collection mappin
    gs
    [java] 09:09:24,061 INFO HbmBinder:2233 - Mapping collection: Parent.child
    ren -> Child
    [java] 09:09:24,076 INFO Configuration:1027 - processing association prope
    rty references
    [java] 09:09:24,076 INFO Configuration:1049 - processing foreign key const
    raints
    [java] 09:09:24,155 INFO DriverManagerConnectionProvider:41 - Using Hibern
    ate built-in connection pool (not for production use!)
    [java] 09:09:24,170 INFO DriverManagerConnectionProvider:42 - Hibernate co
    nnection pool size: 1
    [java] 09:09:24,170 INFO DriverManagerConnectionProvider:45 - autocommit m
    ode: false
    [java] 09:09:24,170 INFO DriverManagerConnectionProvider:80 - using driver
    : sun.jdbc.odbc.JdbcOdbcDriver at URL: jdbc:odbc:MySQL
    [java] 09:09:24,170 INFO DriverManagerConnectionProvider:86 - connection p
    roperties: {}
    [java] 09:09:24,264 INFO SettingsFactory:77 - RDBMS: Microsoft SQL Server,
    version: 08.00.0194
    [java] 09:09:24,264 INFO SettingsFactory:78 - JDBC driver: JDBC-ODBC Bridg
    e (SQLSRV32.DLL), version: 2.0001 (03.85.1117)
    [java] 09:09:24,296 INFO Dialect:100 - Using dialect: org.hibernate.dialec
    t.SQLServerDialect
    [java] 09:09:24,311 INFO TransactionFactoryFactory:31 - Using default tran
    saction strategy (direct JDBC transactions)
    [java] 09:09:24,327 INFO TransactionManagerLookupFactory:33 - No Transacti
    onManagerLookup configured (in JTA environment, use of read-write or transaction
    al second-level cache is not recommended)
    [java] 09:09:24,327 INFO SettingsFactory:125 - Automatic flush during befo
    reCompletion(): disabled
    [java] 09:09:24,327 INFO SettingsFactory:129 - Automatic session close at
    end of transaction: disabled
    [java] 09:09:24,343 INFO SettingsFactory:144 - Scrollable result sets: ena
    bled
    [java] 09:09:24,343 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): d
    isabled
    [java] 09:09:24,343 INFO SettingsFactory:160 - Connection release mode: au
    to
    [java] 09:09:24,358 INFO SettingsFactory:184 - Maximum outer join fetch de
    pth: 1
    [java] 09:09:24,358 INFO SettingsFactory:187 - Default batch fetch size: 1
    [java] 09:09:24,358 INFO SettingsFactory:191 - Generate SQL with comments:
    disabled
    [java] 09:09:24,358 INFO SettingsFactory:195 - Order SQL updates by primar
    y key: disabled
    [java] 09:09:24,358 INFO SettingsFactory:338 - Query translator: org.hiber
    nate.hql.ast.ASTQueryTranslatorFactory
    [java] 09:09:24,374 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTran
    slatorFactory
    [java] 09:09:24,374 INFO SettingsFactory:203 - Query language substitution
    s: {no='N', yes='Y'}
    [java] 09:09:24,374 INFO SettingsFactory:209 - Second-level cache: enabled
    [java] 09:09:24,374 INFO SettingsFactory:213 - Query cache: disabled
    [java] 09:09:24,374 INFO SettingsFactory:325 - Cache provider: org.hiberna
    te.cache.HashtableCacheProvider
    [java] 09:09:24,374 INFO SettingsFactory:228 - Optimize cache for minimal
    puts: disabled
    [java] 09:09:24,374 INFO SettingsFactory:233 - Cache region prefix: hibern
    ate.test
    [java] 09:09:24,405 INFO SettingsFactory:237 - Structured second-level cac
    he entries: disabled
    [java] 09:09:24,437 INFO SettingsFactory:257 - Echoing all SQL to stdout
    [java] 09:09:24,452 INFO SettingsFactory:264 - Statistics: disabled
    [java] 09:09:24,452 INFO SettingsFactory:268 - Deleted entity synthetic id
    entifier rollback: disabled
    [java] 09:09:24,452 INFO SettingsFactory:283 - Default entity-mode: POJO
    [java] 09:09:24,593 INFO SessionFactoryImpl:155 - building session factory
    [java] 09:09:24,938 INFO SessionFactoryObjectFactory:82 - Not binding fact
    ory to JNDI, no JNDI name configured
    [java] 09:09:24,954 INFO SchemaValidator:99 - Running schema validator
    [java] 09:09:24,954 INFO SchemaValidator:107 - fetching database metadata
    [java] 09:09:24,954 INFO Configuration:1014 - processing extends queue
    [java] 09:09:24,954 INFO Configuration:1018 - processing collection mappin
    gs
    [java] 09:09:24,954 INFO Configuration:1027 - processing association prope
    rty references
    [java] 09:09:24,954 INFO Configuration:1049 - processing foreign key const
    raints
    [java] 09:09:24,985 WARN JDBCExceptionReporter:71 - SQL Error: 0, SQLState
    : S1002
    [java] 09:09:24,985 ERROR JDBCExceptionReporter:72 - [Microsoft][ODBC SQL S
    erver Driver]Invalid Descriptor Index
    [java] 09:09:25,001 ERROR SchemaValidator:129 - Error closing connection
    [java] java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Invalid transaction state
    [java] Initial SessionFactory creation failed.org.hibernate.exception.Gener
    icJDBCException: could not get table metadata: Child
    [java] java.lang.ExceptionInInitializerError
    [java] at HibernateUtil.<clinit>(Unknown Source)
    [java] at PCManager.listEvents(Unknown Source)
    [java] at PCManager.main(Unknown Source)
    [java] Caused by: org.hibernate.exception.GenericJDBCException: could not g
    et table metadata: Child
    [java] at org.hibernate.exception.SQLStateConverter.handledNonSpecificE
    xception(SQLStateConverter.java:91)
    [java] at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6879)
    [java] at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7036)
    [java] at sun.jdbc.odbc.JdbcOdbc.SQLDisconnect(JdbcOdbc.java:2988)
    [java] at sun.jdbc.odbc.JdbcOdbcDriver.disconnect(JdbcOdbcDriver.java:9
    80)
    [java] at sun.jdbc.odbc.JdbcOdbcConnection.close(JdbcOdbcConnection.jav
    a:739)
    [java] at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaVal
    idator.java:125)
    [java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryIm
    pl.java:299)
    [java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configura
    tion.java:1145)
    [java] at HibernateUtil.<clinit>(Unknown Source)
    [java] at org.hibernate.exception.SQLStateConverter.convert(SQLStateCon
    verter.java:79)
    [java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExcep
    tionHelper.java:43)
    [java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExcep
    tionHelper.java:29)
    [java] at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(
    DatabaseMetadata.java:100)
    [java] at org.hibernate.cfg.Configuration.validateSchema(Configuration.
    java:946)
    [java] at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaVal
    idator.java:116)
    [java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryIm
    pl.java:299)
    [java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configura
    tion.java:1145)
    [java] ... 3 more
    [java] Caused by: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver
    ]Invalid Descriptor Index
    [java] at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6879)
    [java] at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7036)
    [java] at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3862)
    [java] at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultS
    et.java:5561)
    [java] at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.j
    ava:338)
    [java] at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.j
    ava:395)
    [java] at PCManager.listEvents(Unknown Source)
    [java] at PCManager.main(Unknown Source)
    [java] at org.hibernate.tool.hbm2ddl.TableMetadata.<init>(TableMetadata
    .java:30)
    [java] at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(
    DatabaseMetadata.java:85)
    [java] ... 7 more
    [java] Exception in thread "main"
    [java] Java Result: 1
    BUILD SUCCESSFUL
    Total time: 4 seconds
    Name and version of the database you are using:
    Microsoft SQLServer2000
    The generated SQL (show_sql=true):
    When the program is run with "hbm2ddl.auto" property as create, I get the following output.
    C:\Documents and Settings\mirza\Desktop\hibernate-3.1rc2\MyHibernate>ant run -Daction=store
    Buildfile: build.xml
    clean:
    [delete] Deleting directory C:\Documents and Settings\mirza\Desktop\hibernate
    -3.1rc2\MyHibernate\bin
    [mkdir] Created dir: C:\Documents and Settings\mirza\Desktop\hibernate-3.1rc
    2\MyHibernate\bin
    copy-resources:
    [copy] Copying 4 files to C:\Documents and Settings\mirza\Desktop\hibernate
    -3.1rc2\MyHibernate\bin
    compile:
    [javac] Compiling 5 source files to C:\Documents and Settings\mirza\Desktop\
    hibernate-3.1rc2\MyHibernate\bin
    run:
    [java] 09:12:54,820 INFO Environment:474 - Hibernate 3.1 rc2
    [java] 09:12:54,836 INFO Environment:489 - loaded properties from resource
    hibernate.properties: {hibernate.cglib.use_reflection_optimizer=true, hibernate
    .cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.dial
    ect=org.hibernate.dialect.SQLServerDialect, hibernate.max_fetch_depth=1, hiberna
    te.jdbc.use_streams_for_binary=true, hibernate.format_sql=true, hibernate.query.
    substitutions=yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.cac
    he.region_prefix=hibernate.test, hibernate.jdbc.batch_versioned_data=true, hiber
    nate.connection.pool_size=1}
    [java] 09:12:54,852 INFO Environment:519 - using java.io streams to persis
    t binary types
    [java] 09:12:54,852 INFO Environment:520 - using CGLIB reflection optimize
    r
    [java] 09:12:54,867 INFO Environment:550 - using JDK 1.4 java.sql.Timestam
    p handling
    [java] 09:12:54,946 INFO Configuration:1257 - configuring from resource: /
    hibernate.cfg.xml
    [java] 09:12:54,946 INFO Configuration:1234 - Configuration resource: /hib
    ernate.cfg.xml
    [java] 09:12:55,259 INFO Configuration:460 - Reading mappings from resourc
    e: PCMapping.hbm.xml
    [java] 09:12:55,400 INFO HbmBinder:266 - Mapping class: Parent -> Parent
    [java] 09:12:55,447 INFO HbmBinder:266 - Mapping class: Child -> Child
    [java] 09:12:55,447 INFO Configuration:1368 - Configured SessionFactory: n
    ull
    [java] 09:12:55,447 INFO Configuration:1014 - processing extends queue
    [java] 09:12:55,447 INFO Configuration:1018 - processing collection mappin
    gs
    [java] 09:12:55,447 INFO HbmBinder:2233 - Mapping collection: Parent.child
    ren -> Child
    [java] 09:12:55,463 INFO Configuration:1027 - processing association prope
    rty references
    [java] 09:12:55,479 INFO Configuration:1049 - processing foreign key const
    raints
    [java] 09:12:55,557 INFO DriverManagerConnectionProvider:41 - Using Hibern
    ate built-in connection pool (not for production use!)
    [java] 09:12:55,557 INFO DriverManagerConnectionProvider:42 - Hibernate co
    nnection pool size: 1
    [java] 09:12:55,557 INFO DriverManagerConnectionProvider:45 - autocommit m
    ode: false
    [java] 09:12:55,573 INFO DriverManagerConnectionProvider:80 - using driver
    : sun.jdbc.odbc.JdbcOdbcDriver at URL: jdbc:odbc:MySQL
    [java] 09:12:55,573 INFO DriverManagerConnectionProvider:86 - connection p
    roperties: {}
    [java] 09:12:55,651 INFO SettingsFactory:77 - RDBMS: Microsoft SQL Server,
    version: 08.00.0194
    [java] 09:12:55,667 INFO SettingsFactory:78 - JDBC driver: JDBC-ODBC Bridg
    e (SQLSRV32.DLL), version: 2.0001 (03.85.1117)
    [java] 09:12:55,682 INFO Dialect:100 - Using dialect: org.hibernate.dialec
    t.SQLServerDialect
    [java] 09:12:55,698 INFO TransactionFactoryFactory:31 - Using default tran
    saction strategy (direct JDBC transactions)
    [java] 09:12:55,714 INFO TransactionManagerLookupFactory:33 - No Transacti
    onManagerLookup configured (in JTA environment, use of read-write or transaction
    al second-level cache is not recommended)
    [java] 09:12:55,714 INFO SettingsFactory:125 - Automatic flush during befo
    reCompletion(): disabled
    [java] 09:12:55,714 INFO SettingsFactory:129 - Automatic session close at
    end of transaction: disabled
    [java] 09:12:55,729 INFO SettingsFactory:144 - Scrollable result sets: ena
    bled
    [java] 09:12:55,729 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): d
    isabled
    [java] 09:12:55,745 INFO SettingsFactory:160 - Connection release mode: au
    to
    [java] 09:12:55,745 INFO SettingsFactory:184 - Maximum outer join fetch de
    pth: 1
    [java] 09:12:55,745 INFO SettingsFactory:187 - Default batch fetch size: 1
    [java] 09:12:55,745 INFO SettingsFactory:191 - Generate SQL with comments:
    disabled
    [java] 09:12:55,745 INFO SettingsFactory:195 - Order SQL updates by primar
    y key: disabled
    [java] 09:12:55,745 INFO SettingsFactory:338 - Query translator: org.hiber
    nate.hql.ast.ASTQueryTranslatorFactory
    [java] 09:12:55,777 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTran
    slatorFactory
    [java] 09:12:55,792 INFO SettingsFactory:203 - Query language substitution
    s: {no='N', yes='Y'}
    [java] 09:12:55,792 INFO SettingsFactory:209 - Second-level cache: enabled
    [java] 09:12:55,792 INFO SettingsFactory:213 - Query cache: disabled
    [java] 09:12:55,792 INFO SettingsFactory:325 - Cache provider: org.hiberna
    te.cache.HashtableCacheProvider
    [java] 09:12:55,808 INFO SettingsFactory:228 - Optimize cache for minimal
    puts: disabled
    [java] 09:12:55,808 INFO SettingsFactory:233 - Cache region prefix: hibern
    ate.test
    [java] 09:12:55,808 INFO SettingsFactory:237 - Structured second-level cac
    he entries: disabled
    [java] 09:12:55,839 INFO SettingsFactory:257 - Echoing all SQL to stdout
    [java] 09:12:55,839 INFO SettingsFactory:264 - Statistics: disabled
    [java] 09:12:55,839 INFO SettingsFactory:268 - Deleted entity synthetic id
    entifier rollback: disabled
    [java] 09:12:55,839 INFO SettingsFactory:283 - Default entity-mode: POJO
    [java] 09:12:55,980 INFO SessionFactoryImpl:155 - building session factory
    [java] 09:12:56,325 INFO SessionFactoryObjectFactory:82 - Not binding fact
    ory to JNDI, no JNDI name configured
    [java] 09:12:56,341 INFO Configuration:1014 - processing extends queue
    [java] 09:12:56,341 INFO Configuration:1018 - processing collection mappin
    gs
    [java] 09:12:56,341 INFO Configuration:1027 - processing association prope
    rty references
    [java] 09:12:56,341 INFO Configuration:1049 - processing foreign key const
    raints
    [java] 09:12:56,356 INFO Configuration:1014 - processing extends queue
    [java] 09:12:56,356 INFO Configuration:1018 - processing collection mappin
    gs
    [java] 09:12:56,356 INFO Configuration:1027 - processing association prope
    rty references
    [java] 09:12:56,372 INFO Configuration:1049 - processing foreign key const
    raints
    [java] 09:12:56,372 INFO SchemaExport:153 - Running hbm2ddl schema export
    [java] 09:12:56,388 DEBUG SchemaExport:171 - import file not found: /import
    .sql
    [java] 09:12:56,388 INFO SchemaExport:180 - exporting generated schema to
    database
    [java] 09:12:56,403 DEBUG SchemaExport:283 -
    [java] alter table Child
    [java] drop constraint FK3E104FC976A59A
    [java] 09:12:56,466 DEBUG SchemaExport:283 -
    [java] drop table Child
    [java] 09:12:56,544 DEBUG SchemaExport:283 -
    [java] drop table Parent
    [java] 09:12:56,654 DEBUG SchemaExport:283 -
    [java] create table Child (
    [java] id numeric(19,0) identity not null,
    [java] name varchar(255) null,
    [java] parent_id numeric(19,0) null,
    [java] primary key (id)
    [java] )
    [java] 09:12:56,779 DEBUG SchemaExport:283 -
    [java] create table Parent (
    [java] id numeric(19,0) identity not null,
    [java] primary key (id)
    [java] )
    [java] 09:12:56,873 DEBUG SchemaExport:283 -
    [java] alter table Child
    [java] add constraint FK3E104FC976A59A
    [java] foreign key (parent_id)
    [java] references Parent
    [java] 09:12:56,952 INFO SchemaExport:200 - schema export complete
    [java] 09:12:56,952 WARN JDBCExceptionReporter:48 - SQL Warning: 5701, SQL
    State: 01000
    [java] 09:12:56,952 WARN JDBCExceptionReporter:49 - [Microsoft][ODBC SQL S
    erver Driver][SQL Server]Changed database context to 'master'.
    [java] 09:12:56,952 WARN JDBCExceptionReporter:48 - SQL Warning: 5703, SQL
    State: 01000
    [java] 09:12:56,952 WARN JDBCExceptionReporter:49 - [Microsoft][ODBC SQL S
    erver Driver][SQL Server]Changed language setting to us_english.
    [java] 09:12:56,983 INFO SessionFactoryImpl:432 - Checking 0 named queries
    [java] Hibernate:
    [java] insert
    [java] into
    [java] Child
    [java] (name)
    [java] values
    [java] (?) select
    [java] scope_identity()
    [java] Hibernate:
    [java] insert
    [java] into
    [java] Child
    [java] (name)
    [java] values
    [java] (?) select
    [java] scope_identity()
    [java] Hibernate:
    [java] insert
    [java] into
    [java] Child
    [java] (name)
    [java] values
    [java] (?) select
    [java] scope_identity()
    [java] Hibernate:
    [java] insert
    [java] into
    [java] Parent
    [java] default
    [java] values
    [java] select
    [java] scope_identity()
    [java] Hibernate:
    [java] update
    [java] Child
    [java] set
    [java] parent_id=?
    [java] where
    [java] id=?
    [java] Hibernate:
    [java] update
    [java] Child
    [java] set
    [java] parent_id=?
    [java] where
    [java] id=?
    [java] Hibernate:
    [java] update
    [java] Child
    [java] set
    [java] parent_id=?
    [java] where
    [java] id=?
    [java] 09:12:57,390 INFO SessionFactoryImpl:831 - closing
    [java] 09:12:57,390 INFO DriverManagerConnectionProvider:147 - cleaning up
    connection pool: jdbc:odbc:MySQL
    BUILD SUCCESSFUL
    Total time: 5 seconds
    Debug level Hibernate log excerpt:
    Included in the above description.

    That's not the right mapping for the 1:m relationship in Hibernate.
    First of all, I believe the recommendation is to have a separate .hbm.xml file for each class, so you should have one for Parent and Child.
    Second, you'll find the proper syntax for a one-to-many relationship here:
    http://www.hibernate.org/hib_docs/v3/reference/en/html/tutorial.html#tutorial-associations
    See if those help.
    The tutorial docs for Hibernate are quite good. I'd recommend going through them carefully.
    %

  • ONE-to-MANY relationship between tables and forms in APEX

    I recently started using APEX and I have run into an issue.
    I have a ONE-TO-MANY relationship between two tables, A1 and A2, respectively.
    A1:
    A1_ID
    Item
    A2:
    A2_ID
    SubItem
    A1_ID
    I have 2 forms (lets call it F1 and F2) that I use to capture data for A1 and A2.
    On F2, I have the following fields that are setup to capture data:
         A2.A1_ID
    **A1.Item (this is a drop down that is populated using a SELECT statement where the select uses A1.Item field)
         A2.SubItem (user would enter SubItem)
    Note: A2.A2_ID is populated using a SEQ
    Everytime I pick **A1.Item on F2, is there a way to link to A1 table and display A1.A1_ID for every **A1.Item selected on F2?
    If so, I want to store the value captured in F2 for the A1_ID field into A2 table to maintain my 1-to-MANY relationship.
    If this will work, how do I go about implementing this solution?
    Can someone help me?

    I think it sounds like you are asking for a Master-Detail form. Try that and see what you get.
    chris.

  • How to resolve many-to-many join by 2 one-to-many joins

    Hi,
       I was asked many times how to resolve many to many relationship between two tables. I read to use 2 one -to- many relationships to resolve this. Can some expalin me when many to many relationship occurs between two tables and how to reslove them with practicle examples. Is there any article on this?
    Regards,
    Nanda Kishore

    Hi,
    Please check below link.
    http://www.forumtopics.com/busobj/viewtopic.php?p=859029&sid=20d79e3df07b0d8b41aadfbd902bb6b2
    http://blog.oaktonsoftware.com/2011/04/bridge-tables-and-many-to-many.html
    Thanks,
    Amit

  • Urgent : java bean having bidirectional one to many relationship

    Hi,
    We have complex requirement in our application.
    We need to copy java bean having bidirectional one to many relationship to another javabean having bidirectional one to many relationship..
    E.g
    Class Basket1 {
    public String color;
    pubic String type;
    public List<Basket1> basketList = new ArrayList()
    Class Basket2 {
    public String color;
    pubic String type;
    public List<Basket2> basketList = new ArrayList()
    We need to exact copy Basket1 to Basket2. We are in trouble to copy List of child because we do not have how many child Basket1 have of same type..
    Can someone help us how we can implement such kind of complex object bidirectional one to many relationship??

    I can't see anything bidirectional about these relationships. What I can see is a couple of BasketN classes that look identical so I don't know why they both exist, and they both contain lists of themselves as members, which suggests some kind of tree structure. Nothing bidirectional there. I can see tat these things can form circular object graphs but I don't see why you would want to do that.
    We need to exact copy Basket1 to Basket2And I don't know what that means. Please explain.

  • One to Many table join -- concat field per record grouped by id

    Post Author: wm5
    CA Forum: Formula
    Hello,
    I am using Crystal Reports XI and have two tables that have a one to many relationship and are joined by an JobID (number).
    Below is a sample with relative fields for each table.
    job_table: JobID (number), Manager (text), Status (text)
    jobaudit_table : JobAuditID (number), JobID (Number), FormID (Number)
    There is a one to many relationship with jobaudit_table having multiple records for each JobID in job_table.
    I have created a Group Header using the job_table.JobID and suppressed the detail section.
    In the group header for each JobID I display the JobID, Manager, Status. I also use the below formula to determine if any records in the jobaudit_table has a record where FormID = 90. If so, I display "Yes". If not, "No".
    So my report currently looks like.
    JobID     Manager     Status     Audit Performed
    1           Manager 1  Closed           N
    2          Manager 2   Closed           Y
    Here are the formula's I use to determine if any records in jobaudit_table contains a record where FormID = 90.
    @ja90exists
    if {jobaudit_table.FormID} = 90 then    1else    0;
    if sum({@ja90exists},{job_table.JobID}) = 0 then    "No"else    "Yes";
    Everything so far works fine. What I would like to do now is add a hyperlink to a script to view the job audit when in the above report the "Audit Performed" column is "Yes"
    So Report is now:
    JobID     Manager     Status     Audit Performed
    1           Manager 1  Closed           N
    2          Manager 2   Closed           Y (hyperlink to view audit)
    I cannot figure out how to gather the valid JobAuditIDs where FormID = 90 grouped by JobID to be used in the Group Heading section of the report.
    Also, it is unlikely, but possible that more than one job_audit record exists with FormID = 90 per JobID. So, my hyperlink could look like http://mysite.com/viewjobaudit.aspx?jobid=[jobaudit_table.JobAuditID],[jobaudit_table.JobAuditID] .
    Thanks for any help. And if this post is not clear let me know and I will clarify.
    wm5

    Post Author: bettername
    CA Forum: Formula
    Although I can't think of a way to get multiple hyperlinks, this should be a start.  It (should) hyperlink to the last job/audit in the group that formID of 90.  Oh, I assumed that the hyperlink should have been  xxxx...jobID,jobAuditID! 
    I think there may be a way of getting hyperlinks to every "90" record, but that will involve a subreport, so lets try this first...
    1 - everything from your group header to the group footer...
    2 -  add a formula into the group header that says:
    whileprintingrecords;
    stringvar jobauditID="";
    stringvar jobID:=";
    3 - Then add a formula to the details section:
    whileprintingrecords;
    stringvar jobauditID;
    stringvar jobID;
    if {jobaudit_table.FormID} = 90
    then (jobID:=totext({job_table.job_id},0,""); jobauditID:=totext({jobaudit_table.jobaudit_id},0,"")
    4 - Finally, on your "Audit Performed" formula, have a conditional hyperlink that says:
    whileprintingrecords;
    stringvar jobauditID;
    stringvar jobID;
    if {@audit performed} = "Y" then http://mysite.com/viewjobaudit.aspx?jobid=jobID","+jobauditID

  • One to Many data model solutions

    Hello Friends,
    Recently I got a requirement where I need to  join two line item DSO based on a Reference key, but it is with One to many relationship. I hestitate to use the Infoset because its a very huge DSO, which will affect the report performance.
    I even thought of updating one DSO data to the infocube by getting the lookup values from other DSO in the transformation. I am stuck in every road I take to fulfill this requirement.
    Can anyone share your ideas and thought please...... It will really helpfull..... Thanks for your time.....

    Hello Ganesh,
    Thanks very much for your answer..... I will explain my issue below:
    DSO A: ( Delta load)
    Company_code     G/L_acct     Doc_number     Reference_Key     Invoiced Amount
    1000          1009673          767787          100008          100$
    DSO B: (Full Load monthly)
    Company_code     Reference_Key     Reference_Key_itm     Sold_to          Tax_paid_amt
    1000          100008          010               A          200$
    1000          100008          020               B          300$
    1000          100008          030               C          400$
    1000          100008          040               D          500$
    DSO C:
    Company_code     Reference_Key     Reference_Key_itm     Sold_to          Tax_paid_amt     G/L_acct Invoiced Amount
    1000          100008          010               A          200$          1009673          100$
    1000          100008          020               B          300$          1009673          100$
    1000          100008          030               C          400$          1009673          100$
    1000          100008          040               D          500$          1009673          100$
    If I load DSO B - - > DSO C , and the do look up on DSO A: Then I will miss the delta changes which happen in the DSO A
    Can I load both DSO A and DSO B to DSO C?
    Edited by: Ram on Nov 24, 2009 6:55 PM

  • One to many mapping

    Having trouble with the following poblem.. specially how to code getChildren??????? Help urgent
    Create a class called Families which creates a one-to-many mapping of parent name (String) to Child objects. Create any needed member variables and write the two specified methods. (You do not need to write the Child class.)
    class Families {
    public void addToFamily( String parent, Child child) {
    public List getChildren( String parent) {
    I have done the following..
    import java.util.ArrayList;
    import java.util.List;
    class Families {
    private String parentName;
    List <child> children = new ArrayList();
    public Families(String name){
    this.parentName = name;
    public void addToFamily( String parent, child kid) {
    Families f = new Families(parent);
         f.children.add(kid);      
    public List<child> getChildren( String parent) {
         return this.children;
    }

    Having trouble with the following poblem.. specially
    how to code getChildren??????? Help urgent
    Create a class called Families which creates a
    one-to-many mapping of parent name (String) to Child
    objects. Create any needed member variables and write
    the two specified methods. This key:
    (You do not need to write the Child class.)How can the following line possibly work?
    List <child> children = new ArrayList();It's not syntactically correct, AND you're not writing the Child class.
    %

  • One-to-many graph problem

    Hi,
    I am haviing a crystal report problem. The problem relates to a one-to-many relationship involving two tables.
    I have a similar setup to the following:
    I have 2 database tables: table1 & table2
    table1 consists of 3 fields:
    {id#}, {yes/no},{up/down}
    table2 consists of 2 fields:
    {id#},
    the field can contain any of the following values: 'open', 'closed', 'final', 'complete'.
    The problem is that there exist many states to one id#.
    I have a bar graph in my report that displays a bar for the count of the{yes/no} field and a bar for the count of the {up/down} field. I want also a bar for the count of when the field = 'final'.
    What happens when I write a formula for the field in the second table and place it in the 'show values' section of the chart expert, is the count displayed in each bar on the graph increases significantly. I am assuming this is because there are multiple records in table 2 for each record in table 1.
    What I want to happen is that the graph displays bar 1 and bar 2 correctly and then when I put in the formula for the third bar, it simply displays that bar with the count for when the field = 'final'. I dont want it to affect the whole garph.
    Has anyone got any suggestions on how I can do this?
    I have tried messing around with the distinct records setting in crystal and also by writing an sql query specifying DISTINCT keyword instead of using the select expert, but to no avail.
    Please please can someone help me with this issue.
    Thank you.
    J

    You can add a 1-1 query key through the code API in a descriptor amendment method. You could also define a selection criteria on the 1-m mapping to filter the type=2.
    Example: (see Foundation Library manual 8-17)
    OneToOneQueryKey queryKey = new OneToOneQueryKey();
    queryKey.setName("organization");
    queryKey.setReferenceClass(Organization.class);
    ExpressionBuilder builder = new ExpressionBuilder();
    queryKey.setJoinCriteria(builder.getField("ORGANIZATION.ORG_ID").equal(builder.getParameter("RELATIONSHIP.PARENT_ID").and(builder.getParamater("RELATIONSHIP.RELATIONSHIP_TYPE").equal(2)));
    relationDescriptor.addQueryKey(queryKey);
    Example: (of 1-m mapping with selection criteria)
    OneToManyMapping mapping = new OneToManyMapping();
    mapping.setReferenceClass(Relation.class);
    mapping.setTargetForeignKey("RELATION.PARENT_ID");
    ExpressionBuilder builder = new ExpressionBuilder();
    mapping.setSelectionCriteria(builder.getField("RELATIONSHIP.PARENT_ID").equal(builder.getParameter("ORGANIZATION.ORG_ID").and(builder.getField("RELATIONSHIP.RELATIONSHIP_TYPE").equal(2)));
    orgDescriptor.addMapping(mapping);

  • One-to-many table linking

    Hi all,
    I'm trying to write a report with multiple one-to-many table links.  The issue is I only want a single record from the linked tables.  The main table is an item table and the linked tables are issue and receipt.  I want to display information from the last issue record and the last receipt record along with the item information.  Not sure how to restrict the joins to just a single record (also need to sort desc on dates in the linked tables).  Does this require the use of a view? or a custom sp?
    Thanks for taking your time to help.
    Kevin

    To bring back a single record then you will probably need to use a View , command or SP.
    However, in Crystal you can bring back multiple records and only display the record you want. The easiest way will be to group
    Data on Date and then Item code.
    Place the data you want to see in in Item group footer and suppress details and all other Group headers and footers.
    To get receipt date just use a maximum summary of receipt date in item group footer
    Ian

Maybe you are looking for

  • Business Partner Contacts Define new is blank when addon runs

    version 2007 PL 15 When my addon is running the business partner contacts tab is missing the "Define New" option and contacts cannot be added. When the addon is stopped then the businness partner contacts tab functions normally. There is nothing in t

  • How do i install safari 5.1 or above?

    how do i install safari 5.1 or above?

  • QuickTime, iMovie, and JVC Video miscommunication

    I've been uploading footage from my JVC Everio WS camera to my external hard drive. From there, I drag the footage into an iMovie project. From there, I edit and create magic. However, I've run into the problem of QuickTime no longer recognizing my f

  • External Dictionaries post Upgrade

    External Dictionaries post Upgrade 2008.3 (DEV) Oracle 10g Websphere 6.1 IE6 & 7 Has anyone seen this error after the conversion.  The external dictionary is not recognised and preventing the submission of CONVERTED_SERVICES Error Attached Thank you

  • App setting is missing from IPad

    Several of my apps have disappeared, including the settings app.  I've tried searching, rebooting, but can't find a settings app.