runtime « Map « JPA Q&A





1. Hibernate change fetch mode in runtime    stackoverflow.com

I have two tables related together using one-to-many relation : employee -> department : and relation through department_id in the employee table. I use hibernate : and my hibernate mapping files ...

2. Property Mapping based on dynamic criteria at runtime    stackoverflow.com

I have been sifting through pages on Google looking for the answer to no avail, however I think I am just phrasing the question incorrectly. The scenario is as follows: I have ...

3. Need to map classes to different databases at runtime in Hibernate    stackoverflow.com

I have MainDB database and unknown number (at compile time) of UserDB_1, ..., UserDB_N databases. MainDB contains names of those UserDB databases in some table (new UserDB can be created at ...

4. How to get the DiscriminatorValue at run time    stackoverflow.com

We have the following classes

@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE) // optional annotation as this is default
@DiscriminatorColumn(name = "apType", discriminatorType = DiscriminatorType.STRING, length = 255)
@DiscriminatorValue("AP")
public class ApplicationProcess {
}
And this
@Entity
@DiscriminatorValue("APS")
public class ApplicationProcessScheme extends ApplicationProcess ...

5. How to change hibernate mapping properties at runtime    stackoverflow.com

I have an entity in which i have specified lazy="false" and batch-size="100". It is working fine but in some other scenario i want to remove batch -size and set lazy="true". If ...

6. how to override hibernate fetching strategy at runtime    stackoverflow.com

i saw following statement in book "hibernate in action". anyone can tell me how to override strategy at runtime. and can you do opposite way that is i have fetching strategy ...

7. Exchange Entity Table mapping at Runtime with Eclipselink    stackoverflow.com

is it possible to change the entity-table mapping at runtime with Eclipselink? I have a Entity-View mapping defined with annotations. Now I have the business requirement: "If these Views are empty, ...

8. Hibernate how to get mappings at runtime    forum.hibernate.org

I need to generate some mappings at runtime based on existing ones. so i will need to get mappings from hibernate. i am using hibernate hbm-xml-files to map entities, and need hibernate to give me the mapping files so that i can generate new ones based on them. is there a mapping object for hibernate that i can use it for ...

9. Modify mappings during runtime.    forum.hibernate.org

Newbie Joined: Sun Jan 02, 2011 8:10 pm Posts: 4 Hi. i want to implement 'custom fields' in my projects. I would like to add new column to table during runtime. But after start i see exception. Can you help? Code: org.hibernate.MappingException: property mapping has wrong number of columns: pl.kambu.customfields.data.Person.values type: component[foo,bar] at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:465) at ...





10. Updating Hibernate mapping dynamically at runtime    forum.hibernate.org

Hi, is there a way to update the Hibernate mapping dynamically at runtime? My use case is that I have to run against two versions of the product - the newer version containing a few extra database fields. Based on the version I would like to be able to add the extra fields to the mapping. Is there a way to ...

11. Programmaticly create mapping on runtime    forum.hibernate.org

Hi, I would like to embed Hibernate into an other framework. Therefore I would need to configure Hibernate completly on runtime via the other framework. I found the possibility to create the "basic" configuration via properties directly inside some java classes. Now my question: How can I use mapping without the creation of mapping (.hbm.xml) files ? This is important, because ...

12. Array one-to-many mapping - runtime error    forum.hibernate.org

I obtain runtime error: Caused by: net.sf.hibernate.MappingException: invalid mapping at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:282) at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:322) ... 7 more Caused by: org.xml.sax.SAXParseException: The content of element type "array" must match "(meta*,(cache|jcs-cache)?,key,index,(element|one-to-many|many-to-many|composite-element|many-to-any))". part of hbm.xml Code:

13. Generating hibernate mappings at run time    forum.hibernate.org

To what extent can hibernate persistant/root classes be generated at runtime? What I want to do is generate a complete class with id/version/properties/relationships etc at runtime on top of a predefined mappings file. I've looked at the available classes and all I need seems to be available in the .cfg and .mappings packages. However looking at the code I have some ...

14. Generate DB-Mapping, Java Source/Classes at runtime    forum.hibernate.org

Hi there, In my application the mapping information isn't available at design/compile time. Is it possible to generate the DB-Tables, Java Source and Classes at runtime based on a mapping that I would generate also at runtime? Does anybody did this before? Couldn't find much information how to use the Hibernate Tools directly in the java code and not in Ant.... ...

15. Mapping the sql table and java object in runtime    forum.hibernate.org

Hi, I am facing problem in querying on a table whose database schema is available in another table. Let's say we need to query on the 'data' table. The schema of data table is available in 'schema' table. We can get the schema of the data table only in runtime after querying the 'schema' table. The problem is mapping the 'data' ...

16. Changing mapped table at run time    forum.hibernate.org

Hibernate version: 2.1.7 My application hooks up to a legacy database on an AS/400. This database has "Logical files". Logical files are really indexes over the actual table. Becauase of the way SQL works on the AS/400, I have to specifically point my mapping to the logical (index) I want to use. Here is my question, how do I change the ...





17. how to get the mapping info on runtime    forum.hibernate.org

18. Can you add mappings at runtime?    forum.hibernate.org

What i mean is after the first session factory is created. So suppose I initialize my session factory. Then, at a later time my app loads a plugin which has its own hbm.xml file. I then plan to create a new configuration and add the new mapping file to it. Then create a new session factory and replace the old one. ...

19. overriding lazy at runtime    forum.hibernate.org

i have an objectA that hold a lazy collection of other objectsB. there may be serveral hundred objectsB's hence they are set to lazy load. basically i am storing objectA in the HttpSession and when i come to use objectA i can no longer get the collection of objectB's as the Hibernate Session is closed. is there a way to somehow ...

20. modification of the hibernate mapping at runtime?    forum.hibernate.org

Does anyone know if it is possible to modify the hibernate mapping during runtime? I am using Hibernate 3, and here is a very brief rundown of what I want to accomplish. I have a system which has a set of 4 tables. Each client on the system has their own table set which are all suffixed with their client ID ...

21. Mapping During Runtime    forum.hibernate.org

Hi, for our application it will be necessary to create the mapping to the database during runtime, since metadata (databasetype, -name, -login, tablenames, columns) might nicht be available on compile-time (and might be changed by the user). I get the impression that this could be possible with hibernate (but I am not sure) I want to if there is a tutorial ...

22. Runtime model mapping    forum.hibernate.org

Hi I'm using Hibernate3, and am trying to create model mapping at runtime. What I mean by that is, I don't want to use the XML based mapping, nor do I want to use annotations (I'm using JDK 1.4.2). I want to generate the actual Mapping myself. Now, I know I should createMappings(), then add a bunch of RootClass/SubClass definitions, then ...

23. How to persist runtime inheritance    forum.hibernate.org

Hi! I am using hibernate for quite sometime now and has been a happy user. Recently my project required a solution where runtime inheritance and its persistance was required (so I thought) and its difficult to solve in hibernate. Let me tell you about the problem.... I have an accounting system which has Object model as follows AccountBook (Contains multiple account ...

24. table mapping with runtime object type ?    forum.hibernate.org

Hi, I had a question in mind... suppose my entire framework is working and using an classes by name SuperA , SuperB, SuperC ... SuperZ (assume they have on 'id' key field, there is no hibernate mapping file for these classes). Now I add a jar '1.jar' which extends Super[A-Z] and has class names like SubA1 , SubB1 , SubC1 ... ...

25. Reconfiguration of mapping information at runtime    forum.hibernate.org

Hello All, I have a problem in my application which enables each user to create her own tables conposed of several columns at runtime. I guess I can create table at runtime to use your Hibernate's direct SQL query feature, but I have no good idea how to correspond it to a java class like java.util.Map. I think it isn't recommended, ...

26. Lookup Hibernate class mapping metadata at runtime.    forum.hibernate.org

Hibernate version: 3.1 Hi, Hoping someone can point me in the right direction for how to look up mapping metadata at runtime in an Interceptor. I am using Hibernate Interception in our application to perform a number of key tasks. One of those is audit of data changes. The auditing of changes is handled in the onFlushDirty method of the Interceptor, ...

28. Runtime creation of table and mapping    forum.hibernate.org

Hi, This is the code for it. Configuration config = new Configuration().configure(); SchemaExport sch = new SchemaExport(config); sch.create(true, true); SessionFactory sessionFactory = config.buildSessionFactory(); It drops and creates new tables everytime you run it. sch.create(true, true); This setting shows you the generated SQL as well as DDL is immediately executed in the datadase Though you can change the settings as you like. ...

29. Rename table name in mapping at runtime    forum.hibernate.org

I have several tables with the same structure and I'd like to use only one mapping file. So I want to switch between the tables. I've found the following solution, but I'm not satisfied yet: Code: SessionFactory sessionFactory; Configuration configuration; try{ configuration = new Configuration() ...

30. Creating mapping definitions during runtime    forum.hibernate.org

Hi, is there anybody out there who has a code sniplet that shows me how to create a toMany relation during runtime. I successfully created a toOne relation already with mtoValue = new ManyToOne(table); column = new Column("ORIGIN"); column.setNullable(true); mtoValue.addColumn(column); // mtoValue.setReferencedPropertyName("code"); mtoValue.setReferencedEntityName("Locations"); property = new Property(); property.setName("Start"); property.setValue(mtoValue); property.setInsertable(false); property.setUpdateable(false); pClass.addProperty(property); Any help welcome, thanks in advance, Oliver

31. Creating mapping definitions during runtime    forum.hibernate.org

Hi, is there anybody out there who has a code sniplet that shows me how to create a toMany relation during runtime. I successfully created a toOne relation already with mtoValue = new ManyToOne(table); column = new Column("ORIGIN"); column.setNullable(true); mtoValue.addColumn(column); // mtoValue.setReferencedPropertyName("code"); mtoValue.setReferencedEntityName("Locations"); property = new Property(); property.setName("Start"); property.setValue(mtoValue); property.setInsertable(false); property.setUpdateable(false); pClass.addProperty(property); Any help welcome, thanks in advance, Oliver

33. How to read mapping info in runtime    forum.hibernate.org

Hi! I'm having a problem reading a mapping info during runtime. I have been using metadata but I am having problems reading composite-id info. The mapping file is: