noemi conde

Greenhorn
+ Follow
since May 05, 2010
Merit badge: grant badges
For More
Spain
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by noemi conde

Hi all,

I have a problem when I try to delete an Object "User" which has a collection of Objects "UsersRol", I cannot delete user because I obtain a DataIntegritiViolationException, (I suppose I'm not deleting on cascade, and I got this exception because, the objects related to user cannot exist in the database without user, but, this is the exact reason to delete all of them on cascade)

This code works fine with the operation merge, but I don't know, if I want to delete an object, this object needs to be loaded by hibernate or in the other hand It just need to set its id.
I also try to set the id's of the usersRol collection, but this is still not working

What is my problem ??? I cannot find it !!

Any idea is welcome, thanks in advance.

Here are my mappings:



when I try to delete an instance of user an sql - exception is thrown :

com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -532, SQLSTATE: 23504, SQLERRMC: SCHEMA1.USER_ROL.FK_USEROL_USER



This is the hibernate exception:

org.hibernate.exception.ConstraintViolationException: could not delete: [User#3]



And this is the first exception in the stacktrace:

Caught exception while allowing TestExecutionListener [org.springframework.test.context.transaction.TransactionalTestExecutionListener@1ab600f] to process 'after' execution for test: method [public void UserDaoTest.deleteTest()], instance [UserDaoTest@2fb002], exception [null]
org.springframework.dao.DataIntegrityViolationException: could not delete: [User#3]; nested exception is org.hibernate.exception.ConstraintViolationException: could not delete: [User#3]



And this is the code I try to execute:

@Test
public void deleteTest(){
User user = new User();
user.setUserId(3);
UserRol userRol1 = new UserRol();
userRol1.setUserRolId(10);
Set<UserRol> usersRol = new HashSet<UserRol>();
usersRol.add(userRol1);
userDao.remove(user);
Assert.assertTrue(true);
}



And this is the remove code:


public void remove(E entity) {
final String currentEntityName = getEntityName(entity);

if (LOG.isDebugEnabled()) {
LOG.debug("Removing entity {}", entity);
}

getHibernateTemplate().delete(currentEntityName, entity);
}


Hi ranchies !!!
I've got a problem dealing with composite primary keys in hibernate


Here is the code:




We have a composite primary key with objects from two different schemas, and we don't know how to do the mapping.

The exception thrown when we try to execute this hql query: "Select A from Table_A" is



Do you know what is the problem ???

Any idea is welcome, thanks in advance.

Thanks !!!

I'll try it now !
Hi all !

I've got a problem, one of my entities (A) has a composite primary key, this PK is composed by an Integer which identifies another entity (B) and two strings more, so the three of them identifies this entity (A), here is the problem, can I implement this using Hibernate ??? or I should have a surrogate key instead of this primary key, in that case I suppose I should have an Unique index, indexing all three fields in order to maintain the restrictions of a primary key in those fields.
My Daos should implement a GenericDao parameterized by the type of the Entity, and the type of the primary key, and my primary key don't have a type !!!

Can you help me ???

I found some examples using composite keys, but in all of them, the keys identifies different entities, so you can write another object with an @Embeddable annotation with all the keys, but I get lost because of these two strings, that they don't identify anything at all.

I think I should use the surrogate key option, am I correct ???

What do you think ? Any idea ?? I don't find something like this in google :S

Any idea is welcome,

Thanks in advance !!
Hello everyone!

I'm newie in GXT, here is my problem: I am trying to implement a paging grid that also use filters.
Here is the code:



where "TestData.getCompanies()" gets the data displayed in the grid, and "cm" is the ColumnModel with the configuration for the columns. That is working fine. My problem is that I have a combo to filter the grid. After select a value in the combo, I want to reload the whole grid, and shows only the results filtered. But I want to filter the whole set of data, and not only the data which is in the current page you are looking at. I don't know if I am explaining my situation well... But I would like to update also the number of pages showed.

For example, I have 3000 companies, 1500 of them are from "Italy" and the others 1500 are from "Poland". My grid shows a total of 300 pages. If I am watching one of the pages that only shows companies from "Poland" and I filter "Italy", that page of the grid is empty of data, and the count of pages is still 300 when it would have to reload and only shows 150 pages with the companies that are from "Italy".

I would be very grateful if somebody has any idea.

I suppose I need to extend "PagingModelMemoryProxy" to support filtering (by overriding the load method), but I don't know how to do it.
Is this what I have to do ?

Any idea is welcome,

Thanks in advance !!!




13 years ago
GWT
Hi,
It's already worked out, it was a mistake in the path ...
I didn't know maven recommend some kind of path to put the SQL scripts.
13 years ago
Hi all !

I'd like to drop and create tables, and also insert data into them by using the command mvn sql:execute, I did this before with a postgresql DBMS.

Nom I'm using a ORACLE DBMS, I have 3 diferent databases, and I want to execute the scripts of dropping and creating tables, so I have 3 different profiles in the pom.xml (each one for eache different dababase) when I run that command associate to each profile, the conexion runs ok, but it does not execute any SQL statement,

here the interesting parts of the pom.xml




and the result is:



does anybody know why the hell the scripts are not executed !!! this is driving me crazyyy !!!

any ideas ?? I got no ideas left to try !

Thanks so much !
13 years ago
Hi, thanks for your quick answer, i'm actually looking for this dependency in the whole workspace, but I think it doesn't exist, maybe I must add a new property in my pom.xml, but I'm not sure.

Do you remember what you did to solve this inconvenience ???
I have no ideas and I'm running out of time, and so much wasted whit this problem !

Thanks again !
13 years ago
Hi,

When I changed the parent artifactId

to:

The pom.xml shows this error:
Project build error: For managed dependency jre:javaws:jar: system-scoped dependency must specify an absolute systemPath but is ${java.home}/lib/javaws.jar


and cannot import all the dependencies I have, does anybody knows why ???
any idea ???
please I need some help !!!

Thanks.
13 years ago
Hi,

I can see IModuleProvider.class when I do jar -tvf as you recomend, so I think the jar hasn't got any problem, any ideas left ??

It's so weird, I don't know why doesn't work !!!

and, by the way thanks !!!
14 years ago
Hi,

I've got an web application which use 2 jar libraries made myself, the problem is that one of them needs to reference the other one, and tomcat can't find it.
Both libraries are in WEB-INF/lib, I try to use urlclassloader to load these libraries, but it doesn't work, I don't know the problem, does anybody know ??? any idea ???

Please, I dont have any ideas left.

The code is:



MyClass is included in one of these jars in WEB-INF/lib,

This is the error :



Thanks !!!
14 years ago
Hi,
finally I've just added the jar file instead of creating the library, and it works fine, thanks so much !!!
14 years ago
Hi,

To add the jar file to the classpath I've just added a library called "PostgreSQL JDBC Driver" and put the .jar file into it.
I'm using eclipse IDE, I thought this is the way to do it, I'm wrong ? Anything else to do it ?

Thanks so much!
14 years ago
Hi,

I'm developing an standalone application with spring + hibernate + swing, and maven.
I've got no problems when I run the junit test with maven, but when I try to run my application I've got a BeanCreationException.

Exception:


bean datasource in spring-config:



and the code where the exception is thrown :



And by the way, this class (Controller) is singleton,
Does anybody know what I'm doing wrong ?
Should I use another dataSource ? which one ?
Thanks!
14 years ago