Is there a way to recover the last generated auto_increment identifier generated by an insert when using Hibernate ?
I know from my php background that you can get this information by way of a function call like mysql_insert_id(). I'm operating in grails and using HQL to get a performance boost on some insert operations, but I need to ...
Ok... so here's my actual status:
Been a PHP Scripter for way too long, I think I cover the basis, Good practices (structure, commenting, indenting, workplan, etc), OOP, MVC, security and a fair knowledge of PL/SQL. But never seen a single line of java code and it's time to do some kind of voodoo to "learn XYZ in 21 seconds". The goal i...
I just changed all of the classes in my grails project to a new package. This involved adding the package syntax, and creating the folder structure accordingly. Now I am getting the following hibernate.MappingException:
2010-09-23 15:31:16,755 [main] ERROR [localhost].[/SkillsDB] - Exception sending context initialized event to listene...
I've had the opportunity to rework a good deal of old, poorly maintained perl scripts from a department library into a newer Java design, which hopefully should be more maintainable. Originally, this library did a number of things relating to our Active Directory instance, including things like looking for and reporting on new users, kee...
I have a project with a EJB implementing a JWS Webservice, like this:
@Stateless
@Remote(WebServiceTest.class)
@WebService(
serviceName="TestService",
name="TestName"
)
public class WebServiceTestImpl implements WebServiceTest {
@Override
@WebMethod(operationName="hello")
public String hello() {
return "Hello World!";
}
}
I de...
Pardon the newbie question.
My data model is really simple (two tables; 200 rows in one, 10,000 in the other; natural join between both).
I'm using Hibernate to attempt a simple read/update on these tables.
Doing so keeps throwing OutOfMemory errors (1GB assigned to my JVM).
This seems very unlikely due to natural memory needs, and ...
Hello,
This may seem like a very simple question, but I have been struggling with it for a while. I have two entities Client and User where Client is a parent of User. The entities are annotated as follows:
Client:
@OneToMany(mappedBy = "client", fetch = FetchType.LAZY)
@Cascade({CascadeType.SAVE_UPDATE, CascadeType.DELETE})
...
I have a mysql database with unicode text strings in it. My JSF application (running on tomcat 6) can read these unicode strings out and display them correctly in the browser. All the html charsets are set to UTF-8.
When I save my object, even having made no changes, Hibernate persists it back to the database. If I look directly in the ...
Hi,
Recently i am started using hibernate. to insert or update i am using saveOrUpdate() function.
If i update an entry i works fine. But, with new entry hibernate generate a Query. Buts nothing gets updated in the table.
My scenario is like this,
i am using Many to One & One to Many relationship between two tables[Expense, Category]...
Hi,
In a scenario with two types of entities, Parent and Child:
Parent
- @OneToMany Collection children;
The default is to have lazy loading on the collection of children. This model works great for small numbers of children, but if the number grows very large this seems unsustainable. So for occasions where I think the number of chi...
I've got a one-to-many relationship: Parent record with n Child records. These records are frequently used and read-only and are good candidates for caching.
Here is an approximation of my Hibernate mapping:
`<class name="Parent" table="Parent>
<cache usage="read-only"/>
<id name="primary_key"/>
<property name="natural_key"/>
...
I am trying to run a SQL query in Hibernate. I am using its documentation.
Because of some unknown values i am trying to do inside the Source code.
See this below SQL-Query configuration. How to re-write it in source code itself!!
I tried this
personList = session.createSQLQuery("SELECT person.NAME, person.AGE, person.SEX, address.STR...
In the Hibernate reference manual section 11.2.3 it is stated that 'If the Session throws an exception ... rollback the database transaction, call Session.close() and Discard the Session instance'. Do you have any experience or knowledge about what could be the consequences of not following this must? How is this must affected by us usin...
I've created a test application on my PC to get familiar with Hibernate on an HSQLDB.
I made an executable JAR and moved the application on to a Linux VM. When I run the same program after set up, my HSQLDB throws the following message when I try to run the test app:
A pre-9.0 client attemtped to connect. We rejected them.
This occu...
I want to get through introspection the table name of an object managed by Hibernate (in lazy).
my object contains "org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer" in the property handler.
my object is of type "mypackage.myObjectDO_ _javassist_2 $ $" and does not contain the annotations that the class "mypackage.myObjectDO...
I have JSF application with trinidad components and JAXB/JPA entity beans generated by Hyperjaxb3. In the UI I use Trinidad combo box component that has JPA object as values.
The scenario is:
User make selection in combo box
User clicks on a control that sends request to the server and is returned to the same form
Data from the form w...
I am using Spring+Hibernate for an operation which requires creating and updating literally hundreds of thousands of items. Something like this:
{
...
Foo foo = fooDAO.get(...);
for (int i=0; i<500000; i++) {
Bar bar = barDAO.load(i);
if (bar.needsModification() && foo.foo()) {
bar.setWhatever("new whatever...
I have a big multi-module Maven project with thousands of tests.
Each test loads DAOs, services, etc using the SpringApplicationContext annotation.
My unitils configuration looks like this:
database.driverClassName=org.hsqldb.jdbcDriver
database.url=jdbc:hsqldb:file:mytestdb
database.schemaNames=PUBLIC
database.userName=sa
database.pass...
I have a few domain classes, and I want to be able to populate a new Domain class and persist it to the database via one of my controllers. Here are my classes
class Employee implements Comparable
{
static hasMany = [education:Education]
static mapping = {
education cascade:"all,delete-orphan", lazy:false
}
List<...
I have a table with a column of type XML. When I insert a record into this table from a servlet running in WebSphere on Windows, the insert succeeds. However, when I run exactly the same code in WebSphere on AIX, I get the following exception:
com.ibm.db2.jcc.c.SqlException: Illegal Conversion: Can not convert from "java.lang.String" ...