Hibernate Mapping over 3 tables

Hi!
I have three tables (products, files_to_products, files), which relate to each other as follows:
products <- files_to_products <- files
|;id|;name|; |;product_id|;file_id|; |;id|;name|;data|;
every product can have many or no files associtated to it.
In the java bean, i have a
Map<String filename, byte[] data>
representing the file.
How would the hibernate mapping look like for this? I somehow cant figure out how to map this table structure to something like
    <map name="files" order-by="size asc" table="FILES">       <key column="filename"/>       <element column="FILEDATA" type="binary"/>     </map>
is this possible?

It works only, if all datamanipulations are in the Source-DC. In other case, this DC don't have any data.

Similar Messages

  • How to do hibernate mapping for table or view without a primary key

    Hi,
    Anyone knows how to do hibernate mapping for table or view without a primary key?
    thanks.
    cc

    or you can make all column primary key .Anybody seriously considering that as a good idea should understand the implications:
    1. this requires that each row be unique - that's a minor issue normally, but can be a significant problem in some cases
    2. in practically all databases, a primary key constraint creates a unique index - this has many implications:
    a) in most databases, the index stores a copy of the column data that is indexed - this suggestion therefore more than doubles the data storage required for the data
    b) whenever an indexed column is changed, the index has to be maintained - this suggestion then more than doubles the work that each UPDATE statement has to do, since both the table and the index have to be maintained for any UPDATE at all
    This might work OK for toy projects, but it doesn't scale well at all...

  • Hibernate mapping XML files for the two SQL Server tables below.

    Hello all..,
    Question 1:
    I am working on a project that needs to support a database with an inherited legacy schema that you cannot change. The schema is provided below.Hibernate mapping XML files for the two SQL Server tables below. Please provide those two XML files. Assume some hypothetical package and class names. Assume that no "fancy" stuff such as lazy initialization, optimistic locking etc is needed at this time.
    CREATE TABLE [SURVEY_ANSWERS] (
    [ANSWER_ID] [int] IDENTITY (1,1) NOT NULL,
    [QUESTION_ID] [int] NOT NULL,
    [POSITION] [int] NULL,
    [TEXT] [varchar](350) NULL
    CREATE TABLE [dbo].[SURVEY_QUESTIONS] (
          [QUESTION_ID] [int] IDENTITY (1, 1) NOT NULL ,
          [TEXT] [varchar] (350) NULL
    GO
    ALTER TABLE SURVEY_ANSWERS
    ADD CONSTRAINT pk_SURVEY_ANSWERS PRIMARY KEY(ANSWER_ID,QUESTION_ID);
    ALTER TABLE [dbo].[SURVEY_QUESTIONS] ADD
           PRIMARY KEY  CLUSTERED
                [QUESTION_ID]
    GO
    ALTER TABLE [dbo].[SURVEY_ANSWERS] ADD
           FOREIGN KEY
                [QUESTION_ID]
          ) REFERENCES [dbo].[SURVEY_QUESTIONS] (
                [QUESTION_ID]
          )Question 2:
    Assume that you are working on a project developing, say, a banking application. You are the Architect and thinking that Hibernate ORM should be used for the entire access to the relational database. As usual, you have created (or auto-generated) a set of HBM XML files as well as POJOs for which you define the mappings. Assume now that a new requirement has just popped up. The system needs to be able to import new bank accounts and user information in bulk from a very large XML file at once and store it in the database. Assume the XML file contains all necessary information to populate fields in database tables. As performance is very important for this operation. Given this description, how would you approach the problem?
    Please describe briefly.
    -Thanks and regards
    Praveen Soni

    You're not fooling anyone Dennis_Mox. But nice try.Jeez, man. Mail me at denismox[at]yandex.ru, I will show you that exact test, dammit.

  • Hibernate mapping between JGeometry & SDO_Geometry

    Has anyone figured out how to create a hibernate mapping file for mapping between oracle.spatial.geometry.JGeometry and SDO_Geometry type? Haven't been able to figure out how to do it with UserTypes
    for instance I'd like to create a simple class like the following:
    import oracle.spatial.geometry.JGeometry;
    public class Building {
    private Long id;
    private String label;
    private JGeometry shape;
    public Building() {}
    with a corresponding hibernate mapping file that would contain something like:
    <hibernate-mapping>
    <class name="Building" table="BUILDING">
    <id name="id" column="ID" type="long">
    <generator class="native"/>
    </id>
         <property name="label" type="string" length="100"/>
         <property name="shape" type="JGeometry"/>
    </class>
    </hibernate-mapping>
    that would create a create SQL like:
    CREATE TABLE Buildings (
         id NUMBER PRIMARY Key,
         label VARCHAR(100),
         shape SDO_GEOMETRY)
         storage (initial 1m);

    Hi,
    We're specifying the custom type mapping using the OracleCustomTypeMappingAttribute and not in any configuration.
    The problem is occurring only on our test server and it has worked fine in the past.
    Strangely, our application works fine for a few hours and then the problem starts to occur.
    Once it happens, the problem stays until we re-start the web site or IIS.
    It's since we've done a completely fresh install of Oracle and .NET on the server so it's something to do with that I suspect.
    I can't seem to find any differences between the test server and our development machines however.
    I've tried to enable tracing but the trace file grew to over 1.5 gig within 30 mins so it would be impossible to let it run for hours.
    Even if we did have enough space, the file would be too big to analyse using any tools I know of.
    Any other suggestions would be welcomed.

  • Problem in hibernate mapping

    Hi,
    I am new to hibernate and found some problem in mapping for a simple example. Kindly have a look at my code and stack trace and help me fix the problem.
    Mobile.hbm.xml
    <?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="com.mindtree.entity.MobileInvoice" table="MOBILE">
              <property name="model" column="MODEL"/>
              <property name="make" column="MAKE"/>
              <property name="price" column="PRICE"/>
              <property name="date" column="DATE1" />
              <property name="csex" column="CSEX" />
              <property name="cage" column= "CAGE" />
              <id name="id" column="ID">
                   <generator class="increment"/>
              </id>
         </class>
    </hibernate-mapping>Stacktrace:
    org.hibernate.MappingException: Could not read mappings from resource: Mobile.hbm.xml
         at org.hibernate.cfg.Configuration.addResource(Configuration.java:485)
         at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465)
         at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
         at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
         at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
         at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
         at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
         at com.mindtree.dao.MobileDAOImpl.addInvoice(MobileDAOImpl.java:25)
         at com.mindtree.dao.Test.main(Test.java:18)
    Caused by: org.hibernate.MappingException: invalid mapping
         at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:425)
         at org.hibernate.cfg.Configuration.addResource(Configuration.java:482)
         ... 8 more
    Caused by: org.xml.sax.SAXParseException: The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,(query|sql-query)*)".
         at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
         at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
         at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
         at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
         at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
         at org.dom4j.io.SAXReader.read(SAXReader.java:465)
         at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:422)
         ... 9 moreThanks :)

    for ex:
    hibernate.cfg.xml
    <mapping resource="com/spm/dao/Login.hbm.xml" />
    login.hbm.xml
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <hibernate-mapping>
         <class name="com.dao.Login" table="login">
              <id name="id" type="java.lang.Short">
                   <column name="id" />
                   <generator class="increment" />
              </id>
              <property name="username" type="java.lang.String">
                   <column name="username" length="15" not-null="true" />
              </property>
         </class>
    </hibernate-mapping>

  • Hibernate Mapping Exception Error reading resource: Help Please

    I've downloaded Hibernate this weekend and have been working at getting this up and running in my spare time. I've run into a problem and can't seem to find the solution. I'm hoping some one here can help me out.
    I'm running MyEclipse
    MySQL
    and Hibernate 2 in a struts application
    I've only got one form and table that I'm trying to map right now, but I get the above error when I run this line of code.
    Configuration cfg = new Configuration().addClass(AddCustomerForm.class);
    Does anyone have any ideas. Here are the important sections from the two configuration files
    <!-- hibernate.cfg.xml-->
    <hibernate-configuration>
        <session-factory>
            <!-- properties -->
            <property name="connection.username">PaintTracker</property>
            <property name="connection.url">jdbc:mysql://127.0.0.1:3306/PaintTracker</property>
            <property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
            <property name="connection.password">PaintTracker</property>
            <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
            <property name="show_sql">true</property>
            <mapping resource="com/PaintTracker/struts/form/AddCustomerForm.hbm.xml"/>
        </session-factory>
    <!--AddCustomerForm.hbm.xml -->
    <hibernate-mapping>
         <class name="com.PaintTracker.struts.form.AddCustomerForm" table="customer">
              <id name="customerID" column="CustomerID" type="java.lang.Long" unsaved-value="0">
                   <generator class="identity"/>
              </id>
              <property name="firstName" column="FirstName" type="java.lang.String"/>
              <property name="lastName" column="LastName" type="java.lang.String"/>
              <property name="streetAddress" column="StreetAddress" type="java.lang.String"/>
              <property name="middleInitial" column="MiddleInitial" type="java.lang.String"/>
              <property name="city" column="City" type="java.lang.String"/>
              <property name="state" column="State" type="java.lang.String"/>
              <property name="zipCode" column="ZipCode" type="java.lang.String"/>
              <property name="phoneNumber" column="PhoneNumber" type="java.lang.Long"/>
              <property name="emailAddressLeft" column="EmailAddressLeft" type="java.lang.String"/>
              <property name="emailAddressRight" column="EmailAddressRight" type="java.lang.String"/>
              <property name="company" column="Company" type="java.lang.String"/>          
         </class>
    </hibernate-mapping>

    ok finally gotten back to this and rewrote a bunch of the code. I'm getting almost the same error, but not quite.
    I'm still getting org.hibernate.MappingException: Error reading resource: but it is pointing to the first mapping resource located inside the hibernate.cfg.xml.. so I know it is finding and making it inside the hibernate.cfg.xml.
    this is the code that the exception occurs in.
    the actual line is the configuration.configure(); in the else statement.
    public HibernateUtil(URL url2) {
              Configuration configuration = new Configuration();
              log.info("configuration_static is null");
              log.debug("configuring configuration_static from " + url2);
              try {
                   if (url2 != null)
                        configuration.configure(url2);
                   else
                        configuration.configure();
                   this.sessionFactory = configuration.buildSessionFactory();
                   log.info("Configuration complete");
              } catch (HibernateException e) {
                   log.error(e);
                   System.out.println(e);
                   configuration = null;
                   log.info("Configuration failed.  Setting config to null!");
         }The resource I am trying to read is located correctly (eclipse lets you navigate to and choose the xml file to use.. it then builds the hibernate.cfg.xml file for you.)
    here is a copy of the resource that is giving me a problem... whichever resource I have listed first is the one the exception is thrown for... so I'm hoping I just have something mixed up in the way I'm writing my xml files.
    <hibernate-mapping package="com.WorkoutTracker.db.model">
         <class name="com.WorkoutTracker.db.model.User" table="user">
              <id name="userID" column="userId" type="java.lang.Long" unsaved-value="0">
                   <generator class="increment"/>
              </id>
              <property name="userFName" column="userFName" type="java.lang.String"/>
              <property name="userLName" column="userLName" type="java.lang.String"/>
         </class>
    </hibernate-mapping>

  • Hibernate mapping not working

    Greetings,
    I have worked with Hibernate only once or twice before and never had the chance to go any deeper in it. But based on a working sample I have built this mapping for a new project of mine but unable I am to make it work. I'd be delighted to have point outs to what is leading to the exceptions on this... here are my codes:
    package br.com.realstatemanagement.entities;
    import java.util.Date; import java.util.Set; public class Customer { private int customerID; private String firstName; private String lastName; private Date birthDate; private String address; private String neighborhood; private String city; private String state; private String zipCode; private String country="BRASIL"; private String socSecNo; private String identity; private CustomerContacts[] contact; public CustomerContacts[] getContact() { return contact; } public void setContact(CustomerContacts[] contact) { this.contact = contact; } public void setCountry(String country) { this.country = country; } public int getCustomerID() { return customerID; } public void setCustomerID(int customerID) { this.customerID = customerID; } public String getZipCode() { return zipCode; } public void setZipCode(String zipCode) { this.zipCode = zipCode; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public Date getBirthDate() { return birthDate; } public void setBirthDate(Date birthDate) { this.birthDate = birthDate; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getNeighborhood() { return neighborhood; } public void setNeighborhood(String neighborhood) { this.neighborhood = neighborhood; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getSocSecNo() { return socSecNo; } public void setSocSecNo(String socSecNo) { this.socSecNo = socSecNo; } public String getIdentity() { return identity; } public void setIdentity(String identity) { this.identity = identity; } public String getCountry() { return country; } }
    package br.com.realstatemanagement.entities; public class CustomerContacts { private int contactId; private String type; private String contact; public int getContactId() { return contactId; } public void setContactId(int contactId) { this.contactId = contactId; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getContact() { return contact; } public void setContact(String contact) { this.contact = contact; } }
    Follows the mappings....
    <?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="br.com.realstatemanagement.entities.CustomerContacts" table="CustomerContacts">   <id name="contactId" type="int" column="contact_id" >   <generator class="increment"/>   </id>   <property name="type" type="string">     <column name="type" />   </property>   <property name="contact" type="string">     <column name="contact"/>   </property> </class> </hibernate-mapping>
    <?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="br.com.realstatemanagement.entities.Customer" table="Customer">   <id name="customerID" type="int" column="customer_id" >   <generator class="increment"/>   </id>   <property name="firstName">     <column name="first_name" />   </property>   <property name="lastName">     <column name="last_name"/>   </property>   <property name="birthDate">     <column name="birthDate"/>   </property>   <property name="address">   <column name="address" />   </property>   <property name="neighborhood">   <column name="neighborhood" />   </property>   <property name="city">   <column name="city" />   </property>   <property name="state">   <column name="state" />   </property>   <property name="zipCode">   <column name="zipCode" />   </property>   <property name="country">   <column name="country" />   </property>   <property name="socSecNo">   <column name="socSecNo" />   </property>   <property name="identity">   <column name="identity" />   </property>   <many-to-one name="contact" column="contact_id" class="br.com.realstatemanagement.entities.CustomerContacts" insert="false" update="false"/> </class> </hibernate-mapping>
    Kindly help me out on this...
    Thanks very much

    Apologies... it is not that I did not want to put the exception details nor did I not intended to, I simply forgot... Here it is, am once again I am sorry for forgetting about it:
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: javax.el.PropertyNotFoundException: Property 'CustomerContacts' not found on type br.com.realstatemanagement.entities.Customer
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    root cause
    javax.el.PropertyNotFoundException: Property 'CustomerContacts' not found on type br.com.realstatemanagement.entities.Customer
         javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:193)
         javax.el.BeanELResolver$BeanProperties.access$400(BeanELResolver.java:170)
         javax.el.BeanELResolver.property(BeanELResolver.java:279)
         javax.el.BeanELResolver.getValue(BeanELResolver.java:60)
         javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
         org.apache.el.parser.AstValue.getValue(AstValue.java:118)
         org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
         org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:935)
         org.apache.jsp.customers_jsp._jspx_meth_c_005fout_005f4(customers_jsp.java:318)
         org.apache.jsp.customers_jsp._jspx_meth_c_005fforEach_005f0(customers_jsp.java:208)
         org.apache.jsp.customers_jsp._jspService(customers_jsp.java:134)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

  • Hibernate mapping

    I get an error when i do -> new Configuration().configure();  The error is "Could not parse mapping document from resource Client.hbm.xml"
    Glassfish gives the messages:
    configuring from resource: /hibernate.cfg.xml
    Configuration resource: /hibernate.cfg.xml
    Reading mappings from resource : Client.hbm.xml
    Error parsing XML: XML InputStream(1) Document is invalid: no grammar found.
    Error parsing XML: XML InputStream(1) Document root element "hibernate-mapping", must match DOCTYPE root "null".
    Here is my simple Client.hbm.xml mapping file:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <hibernate-mapping>
    <class dynamic-insert="false" dynamic-update="false" mutable="true"
    name="icmmclientsmanager.Client"
    optimistic-lock="version"
    polymorphism="implicit"
    select-before-update="false" table="Clients">
    <id column="cId" name="cid">
    <generator class="identity"/>
    </id>
    <property column="cName" name="cName"/>
    <property column="cAddress" name="cAddress"/>
    </class>
    </hibernate-mapping>
    "Please help!!"Edited by: dof on Jun 4, 2008 6:38 PM

    Might be because it's not finding the file? Should i understand from the error that it's finding the file but there is something else.
    Here is my hibernate.cfg.xml, maybe the problem is here
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
    <hibernate-configuration>
        <session-factory name="session1">
            <property name="hibernate.dialect">
                org.hibernate.dialect.DerbyDialect
            </property>
            <property name="hibernate.connection.driver_class">
                com.mysql.jdbc.Driver
            </property>
            <property name="hibernate.connection.url">
                jdbc:mySql://localhost:3306/ICMMDev
            </property>
            <property name="hibernate.connection.username">
                root
            </property>
            <property name="hibernate.connection.password">
                password
            </property>
            <property name="hibernate.show_sql">
                true
            </property>
            <property name="hibernate.current_session_context_class">
                thread
            </property>
            <mapping resource="Client.hbm.xml"/>
        </session-factory>
    </hibernate-configuration>

  • Repeated column in mapping error - Hibernate mapping

    Hi, I am relatively new to using Hibernate. I have two tables which I have tried to map unsuccesfully.
    Table 1:
    Primary Key(Instrument) -> Generated using function.
    Table 2:
    Primary Key(Instrument) -> Referenced from primary key of table 1
    Table 3:
    Primary Key(Instrument) -> Referenced from primary key of table 2
    Additional Column(Parent_Instrument) -> Referenced from the primary key of table 2
    So, two columns in Table 3 have to be mapped to the primary key of table 2.
    I have tried mapping them but am getting the following error:
    Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: com.db.csb.model.securitycreation.entities.tradegate.WiBonds column: INSTRUMENT (should be mapped with insert="false" update="false")
         at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:652)
         at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:674)
         at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:696)
         at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:450)
         at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
         at org.hibernate.cfg.Configuration.validate(Configuration.java:1102)
         at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287)
         at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
         at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:807)
         at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:740)
         at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:131)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1062)
         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1029)
         ... 32 moreThe following is my code:
    TABLE 2
    @Entity
    @Table(name="BOND_SPEC")
    @Id
         @GenericGenerator
         @GeneratedValue
         @Column(name="INSTRUMENT", nullable=false,insertable=false,updatable=false)
         public long getInstrument() {
              return instrument;
         public void setInstrument(long instrument) {
              this.instrument = instrument;
    @OneToMany
         @JoinColumn(name = "INSTRUMENT", nullable=false, insertable=false)
         public Set<WiBonds> getWiBonds(){
              return Wi_Bonds;
         public void setWiBonds(Set<WiBonds> Wi_Bonds){
              this.Wi_Bonds = Wi_Bonds;
    TABLE 3
    @Entity
    @Table(name="WI_BONDS")
         @Id
         @GenericGenerator(name = "fk_bondspec", strategy = "foreign", parameters = { @Parameter(name = "property", value = "BondSpec") })
         @GeneratedValue(generator = "fk_bondspec")
         @Column(name="INSTRUMENT", nullable=false,insertable=false,updatable=false)     
         public long getInstrument() {
              return instrument;
         public void setInstrument(long instrument) {
              this.instrument = instrument;
         @ManyToOne(targetEntity = BondSpec.class)
         @JoinColumn(name = "INSTRUMENT", nullable = false, insertable=false, updatable=false)
         public BondSpec getBondSpec() {
         public void setbondSpec(BondSpec bondspec) {
         @OneToOne(targetEntity = BondSpec.class)
         @JoinColumn(name = "PARENT_INSTRUMENT", nullable = false, insertable = false, updatable = false, unique=true)
         public long getParent_instrument() {
         public void setParent_instrument(long parent_instrument) {
         }What am I doing wrong?

    theraptor wrote:
    I probably didn't explain it correctly. I am trying to populate these tables with data about financial instruments.
    Table 2 and 3 share a primary key (INSTRUMENT). The primary key is generated in table 2, and the same value has to be later inserted into table 3. Sorry, I'm not following this at all. I don't think two tables should "share" a primary key. Both should have their own. Perhaps Table 3 would have a foreign key relationship with Table 2. OR the two tables should be one. But this notion of sharing doesn't sound right to me, and apparently Hibernate agrees. I think you have a bad design.
    Table 2 has a one to many relation with table 3. Then they can't share a primary key. It's 1:m, which you can easily model with Hibernate.
    (By many I mean it could be 0 as well, since hibernate does not provide a (one to 'maybe' one 'maybe zero) relation.Fine. Then it's a 1:m relationship. You've been thinking about it incorrect.
    Table 3 has an additional column PARENT_INSTRUMENT which is a foreign key to the the primary key of table 2.No. Wrong.
    Yes Instrument is financial in nature. However, I am not trying to model what you have spoken about above.Yes, I get it. Listen to Hibernate - your original idea is quite incorrect. Table 2 is 1:m with Table 3. Model it that way, and forget about this incorrect notion of "sharing a primary key". Give Table 3 its own auto generated key.
    %

  • MAPI over HTTP not working correctly, Outlook 2013 clients prompting for credentials during profile creation or opening depending on security of virtual directory

    ENVIRONMENT
    -1 Exchange 2013 SP1 CU7 server with all roles that is also a hybrid server with Office 365 tenant, mailboxes are all on premise only LYNC online is being utilized right now.
    -Exchange 2013 public folders
    -Mix of Outlook 2013 SP1 and Outlook 2010 SP3 clients all fully update to day as of Feb 2015
    Outlook anywhere is working perfectly across all clients both internally and externally using autodiscover.  Both Outlook 2013 and 2010 clients can open the program and create a profile automatically via autodiscover and no additional logon prompts
    are seen.
    We set the internal and external mapi virtual directory URLs to a valid URL that also matches the Exchange 2013 SSL certificate.  We set the security to ntlm, negotiate on the mapi virtual directory.  We reset IIS and enabled mapi over http in
    the org config.  We run in to problems here.
    Outlook 2010 clients appear to be working fine.  We can create a new profile and open and close Outlook without any logon prompts and verify that MAPIHTTP and Negotiate are used to connect to Exchange.
    Outlook 2013 clients are having problems.  As soon as we try to create a profile it says your administrator has made a change that requires you to restart outlook and then a windows logon prompt appears. If we authenticate Outlook will open and connect.
      This logon prompt should not occur.    We can confirm that it is connecting via MAPI HTTP and Negotiate.
    If we set the mapi virtual directory to NTLM only then a logon prompt also appears during every open of Outlook 2013.  We can confirm that it is trying to connect with MAPIHTTP via NTLM in the outlook connection test screen.
    I do not understand this behavior by Outlook 2013 which was supposed to be designed with MAPI HTTP in mind.  I would think the same issues would occur with Outlook 2010 but they do not.  I am not sure how to resolve this and I am looking for help.

    I have the same problem. Exchange and Outlook are both up to date. After creating a new profile Outlook prompts for username/password. A lot of users also get this prompt while
    working - the profiles have been "migrated" from Exchange server 2010. <o:p></o:p>
    Niko, as i can see in your screenshot you do not have Mapi over HTTP enabled. Why? You can change settings in the security tab – if you have Mapi over
    HTTP enabled all options are grayed out (please correct me if I
    am wrong):
    This is a very annoying thing – does anybody else have the same problem?
    Any suggestions on this?
    Marc

  • Value Mapping through Tables in R/3 from XI

    Hi All,
    I'm new to XI and got a scenario as "Value Mapping through Tables in R/3 from XI". Kindly do tell me the steps which I should follow to complete this scenario. I'm from ABAP so table creation is known to me, what next should I do after table creation?
    Thanks in Advance to all of you,
    Sreedhar

    sree,
    value mapping are done using message mapping. In message mapping you have to make a RFC call to query the db and get the response. were you have to write a java function in mapping program.
    check this blog, it speaks on value mapping
    /people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i

  • Hibernate mapping editor not working fully

    My hibernate mapping editor is not working fully. I can manually enter a new property into the xml and the design pane will update but if I try to add a new property in the design pane it only adds "<property/>" without the attributes specified.
    I looked at my workshop log and I did find the following exception:
    BEGIN EXCEPTION-
    !ENTRY org.eclipse.ui 4 0 2007-03-13 09:08:37.939
    !MESSAGE Failed to execute runnable (java.lang.NullPointerException)
    !STACK 0
    org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException)
         at org.eclipse.swt.SWT.error(SWT.java:3374)
         at org.eclipse.swt.SWT.error(SWT.java:3297)
         at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:126)
         at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3325)
         at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971)
         at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
         at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
         at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
         at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
         at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
         at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
         at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
         at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
         at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
         at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
         at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
         at org.eclipse.core.launcher.Main.run(Main.java:977)
         at org.eclipse.core.launcher.Main.eclipse_main(Main.java:952)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.m7.installer.util.NitroxMain$1.run(NitroxMain.java:36)
         at java.awt.event.InvocationEvent.dispatch(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.lang.NullPointerException
         at com.m7.wide.doceditor.XmlTagCommander$_A.actionPerformed(Unknown Source)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.AbstractButton.doClick(Unknown Source)
         at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
         at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at com.m7.wide.eclipse.jstudio.Plugin$_A.A(Unknown Source)
         at com.m7.wide.eclipse.jstudio.Plugin$4.run(Unknown Source)
         at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
         at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
         ... 32 more
    ---END EXCEPTION---
    Any ideas on how to fix this?
    Thanks,
    Avi.

    Yes, there is a known issue using the latest update of 1.4.2 or 1.5.0 vm.
    Generally, Workshop should work fine with 1.4.2 or 1.5.0 series. You can find the supported platform info at
    http://edocs.bea.com/workshop/docs92/supportedplatforms33.html
    FYI:
    http://forums.bea.com/bea/thread.jspa?threadID=400001144&tstart=15&mod=1169490304818
    http://forums.bea.com/bea/thread.jspa?threadID=400001987&tstart=0&mod=1172533558688

  • Mapi over HTTP issue

    Hi all!
    Hope somebody can help me out. In my test lab, where I`m experimenting with Exchange 2013 SP1 and Outlook 2013 SP1 I came across very annoying thing.
    Let me explain a little bit more about config that worked.
    Outlook 2013 connected to Exchange 2013 via RPC over HTTPS is working great actually really great. I have created my own certs and imported ROOT CA cert to all of my machines and things are working peachy. As part of my plans for 2014 I have to test and
    deploy MAPI over HTTP sometime at the end of 2014 in our company (and migrate fromEX2007 but this is different story).
    OK so I`ve enabled MAPI over HTTP on my test server and configured 5 virtual machines with different accounts to test things out. Started Outlooks, accepted "Your administrator has made change ....." prompts and here we go, I`m connected MAPI/HTTP
    and all works really great.
    Except for one thing. When it does connect, things are super fast and it works as it should. But sometimes it does not connect right away and it is sluggish in performance. Also Outlook is missing "Quick steps" menu, see attached image:
    I restarted all servers, clients, clean Outlook install nothing helps.
    When RPC/HTTPS I could quit and start Outlook 10 times and it worked 10/10 without problems.
    When MAPI/HTTP I restart outlook and it works 6/10, so 4 times I get messed up Outlook and very poor performance.
    Any idea where to start troubleshooting? Maybe Outlook has a bug or 2 with this mode?
    Server is correctly sized and backed up by enough of memory and CPU, mailboxes have 100-3500 items in them.
    Again, RPC/HTTPS works every time without any problem.
    MAPI/HTTP works lets say 6 times without any prolem at all and really works great but 4 times out of 10 it makes me want to throw it away :)
    If someone knows best way to troubleshoot this one, please let me know.
    Regards,
    G

    Hi,
    From your information, when Outlook hang on PC A, there was no problem to connect at the same time from computer B, so the client side related issue causing this problem is more likely. For
    example, when Outlook was trying to connect to Exchange server, it fails due to the temporary Network issue, or it hang when loading something. As far as I know, it may also be caused by the local OST file. But it is difficult to do troubleshooting since there
    could be many possible causes and more logs may be required to do troubleshooting.
    Please try to run Outlook in safe mode by running "Outlook.exe /safe", see if we can reproduce this issue.
    Thanks
    Jessie

  • Is Mapping Lookup table possible with IDOC to FIle scenario

    Hi all,
    Need suggestion, I am using SP16
    My sceanrio is IDOC to FIles, and have to use a Mapping Lookup tables for some of the fields within the mapping...
    'Crossref:  PlantLoc_to_WhseComDiv.  Value mapping lookup to take two fields from SAP and convert to WMS 3-digit value'
    How to go with this, since i have checked in SAP library that it is for only RFC,JDBC,SOAP adapters ...
    Need u r valuable inputs,
    Regards,
    sridhar

    You can use RFC or SOAP or JDBC lookup in your mapping.Why not?..It does not mean that we use the lookups only in RFC secnarios.You can use them in any scenario.

  • How to map 2 tables together into a new one, like an Union?

    Hi.
    I am new in Oracle Data Warehouse Builder and what I'm wanting to do could be simple.
    My question is: How to map 2 tables into a new one? That is, what I need is to do a Union.
    See the following tables:
    What I have is:
    ---------------+ ---------------+
    | A | B | | A | B |
    |--------------- |---------------
    | 10 | 34 | | 13 | 39 |
    ---------------+ ---------------+
    Table 1 Table 2
    What I wish is:
    ---------------+ ----------------------+
    | A | B | Original table |
    |--------------- ----------------------+
    | 10 | 34 | 1 |
    |--------------- ----------------------+
    | 13 | 39 | 2 |
    |--------------- ----------------------+
    Then, I need put all data together into a new table and this new table should has a new column showing the original source of data to each record.
    Can I do such thing?
    I'm using the Oracle Warehouse Builder and trying to do a map in this way.
    Any hint will be very helpful. I also will appreciate an indication of some document which can show how to do it.
    Thanks .
    Rodrigo Pimenta.
    Brazil.

    Use the SET OPERATOR. That should help i guess.

Maybe you are looking for

  • Creative Cloud Error Message when Downloading a file

    I have Adobe Creative Team Cloud. I loaded a file onto the cloud on April 22. Now I am trying to download it. I get an error message ... "Unable to download. Unable to open this internet site. The requested site is either unavailable or can not be fo

  • Help with JcomboBoxes

    Hi, Im having trouble with a combobox I have created a bean class for an ftp site, that contains; - ftp site name - address - username - password I then create an array of these sites and add them to the jComboBox. I only want to display the ftp site

  • Cfmail attachment

    I am trying to include an attachemnt in cfmail, for  the first time. Reviewing some of the online documentation and techniques, I found this easy one - I could not get it to work using variables so I hardcoded and it works. <cfmail to=[email protecte

  • How to CIF vendor partner function

    Hi All, Can someone explain how to CIF the vendor partner function into SNC ? Does the standard Integration model work for it ? Regards Vivek Jaju

  • There is a calendar event on my iphone that I can't remove. It doesn't show up on my calendar on my Mac. Help!

    My iphone calendar is set to sync with my calendar on my Mac. However, there is an old recurring event that continues to appear on my iphone, although I've deleted it from my calender on my Mac. I can't figure out how to delete it on my iphone. Any s