I am working on a program that uses Spring and obtains Hibernate transactions transparently using a TransactionInterceptor. This makes it very convenient to say "when this method is invoked from some other class, wrap it in a transaction if it's not already in one."
However, I have a class that needs to attempt a write and must find ou...
Consider the following hibernate configuration:
<class name="Person">
<id name="id" column="personId">
<generator class="native"/>
</id>
<set name="addresses" table="PersonAddress">
<key column="personId"/>
<many-to-many column="addressId"
class="Address"/>
</set>
</class>
<class name="Address">
<id name="id" column...
I'm doing some werid reporting from JPA datastore.
I need to select (using EJBQL) list of objects and these objects contain collection of entities ie I have class that is constructed by:
FOOBean(String param1,
String param2,
List<Entity> listParam)
(notice that third parapeter is a list)
And I want to select list of thes...
Hello,
I need improve the traceability in a Web Application that usually run on fixed db user. The DBA should have a fast access for the information about the heavy users that are degrading the database.
5 years ago, I implemented a .NET ORM engine which makes a log of user and the server using the DBMS_APPLICATION_INFO package. Using ...
I'm using Hibernate JPA and Spring in my project. Suppose if I try to insert a record with duplicate key value, the insert query will throw an exception.
Now, is it possible to get the table name, field name and possible cause for the exception from the SQL Exception object at run time !?
...
Okay, so I've got iReport up and running, and I can now run HQL queries in it, and it will fetch back objects, and put them in the Fields section of the Report inspector.
Do I really need to flatten out all my queries so that I only return one "level" of actual data values, and not my entity objects? I'd rather like to just return the ...
We are trying to dynamically generate an IN clause for a native sql query to return a JPA entity. Hibernate is our JPA provider. Our code looks something like this.
@NamedQuery(
name="fooQuery",
queryString="select f from Foo f where f.status in (?1)"
)
....
Query q = entityManager.createNamedQuery("fooQuery");
q.setParamete...
I have a method that does a bunch of things; amongst them doing a number of inserts and updates. It's declared thusly...
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, readOnly = false)
public int saveAll(){
//do stuff;
}
It works exactly as it is supposed to and I have no problems with it. There ar...
I am new to the Hibernate Search. At this point in time, I need few clarification.
How Index.Tokenized and Index.Untokenized will behave?
If I want to load all the data (when I am giving empty in the seach box) how can I write Lucen query?
...
My hibernate versioning is issuing an update statement for no apparent reason.
In my BankAccount mapping file:
<version type="dbtimestamp" name="modified" column="Modified"/>
inthe AvailableBalance mapping file:
<many-to-one name="bankAccount" class="model.businessdomain.orm.BankAccount" fetch="select" >
<column name="BankAccoun...
The default mapping from an Oracle NUMBER value is into BigNumber... How can I get a scalar result query to return a Long instead?
...
After reading Hibernate: hbm2ddl.auto=update in production? some questions arose.
First of all, the reason for I'm using Hibernate is to be database vendor independent (no need to write 10 versions of the "same" sql query, eg. tsql vs. sql).
My problem appears when it's time to create the database schemas (production environment). As f...
What approach do you have towards creating and maintaining database indexes when using ORM such as NHibernate/Hibernate.
Since the ORM is generating the queries, are there any tools you could recommend that could analyze query plans of those and suggest the kind of indexes that should be created?
My current approach is ... wait until...
What it says on the tin; I want to modify a collection in Hibernate without forcing the collection to load, since it is a large volume of data (~100,000 records, monotonically increasing).
Right now, I add an element to this list by calling getEvents ().add (newEvent) which, of course, causes events to be populated.
Here's the mapping...
I'm researching the development of Enterprise Applications in Java, .NET and Groovy. For each platform, we're going to try how hard it is to realize a simple SOAP web service. We'll use the tools and libraries that are most commonly used, to research the real world as accurately as possible.
In this regard, would it be best to use the n...
I've got a one-to-one relation between a dealer and a seller which should be lazy using a proxy. For the side on which the foreign key is defined (the seller, references the dealer), this works fine. But it doesn't work from the other side - the seller is always loaded eagerly. I set constrained="true" as described in "Some explanations ...
I'm trying to map a one to "zero or one" relationship in Hibernate. I think I may have found a way using a many-to-one.
class A {
private B b;
// ... getters and setters
}
class B {
private A a;
}
Class A's mapping specifies:
<many-to-one name="b" class="B"
insert="false" update="false"
column="id" unique="true"/>
and C...
The hibernate (I'm using version 3.4) documentation for hql says that it supports interfaces, and I'm having trouble getting it to work. I have some persistent classes (not inherited from eachother, but sharing many functions) that all share an interfaces (CategorizableEntity). I can use it with instanceof in my java code, but I cannot...
i have many to many relation ship between two table and jenerate new join table in hibernate
now how can i insert record in join table by updatation of both table
say two table are tbluser and tbldomain
i have to insert record in tbluserdomainrelation from both side(that is from tbluser and tbldomain)
at present i can insert record in ...
i have two table with many to many relationship when i apply findbyall method to this
table it will retrieve one record multiple time (that is the record will be displayed for this perticular table as many time as there are different relation ship with other table)
so how can i display each record once only.
thank in advance.
...