Nick Carag

Greenhorn
+ Follow
since Dec 08, 2010
Merit badge: grant badges
For More
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nick Carag

It's working now, I added logback core and classic jar in WEB-INF/lib with logback.xml under WEB-INF classes but one thing is still strange. The JPA through Hibernate is provided by JBoss, any log related to Hibernate is written on the console (maybe JBoss logmanager?) but not in the log file configured in logback.xml, while i can see the log statements added through the Logger class of slf4j by my webapp.

Any ideas? Thanks.
12 years ago
Is there a working configuration? I've read about jboss logmanager but I want just to use slf4j over logback.

Thanks
12 years ago
I'm sorry for using your post, but I have your same configuration (even if I'm using Spring 3.0.5) and I didn't succeed to make it work with jboss 5/6. I have resolved the datasource's problem but now it's like there are two autodetections of the annotated entities classes. In the first the entities are found and bounded, in the second not so any queries failed for entity "not mapped". Do you have a similar problem?

Sorry again and thanks
12 years ago
Other suggestions?

Thanks
12 years ago

Hebert Coelho wrote:I have an application that we test it with the database, HSQLDB.

I think it is a better approach because you do not need to mock anything. Maybe this will help you to have an idea.JUnit with HSQLDB, JPA and Hibernate



Thanks for the reply. The Unit Tests on data-model are ok (I already use HSQLDB and the approach described in your link), my question is about testing the service layer. Classes in service layer use repositories and daos of data-model layer. Do I have to mock them or to use the test configuration of data-model (so HSQLDB)? If the second, i have to use the src/test/resources folder as described in my first post?
12 years ago
Hi All,

i have a project with a structure like this:


|--core
|
|--commons
|
|--data-model
|
|--service
|

and so on. I realized all the tests on the data-model module using HSQLDB (with JPA 2.0 + Hibernate 3.6.7) and now i've started writing tests for the service module. It's made up of different services that use DAO/repository classes so my question is, should I continue using the test database configuration or just mock the data-model classes?
I'm using maven 3 as build tool and I've added the src/test/resources folder of data-model as testResource in the service's pom.

Thanks


12 years ago
Finally I've mapped property localeCode as follow

But is it correct? Is there another way to achieve the same result?
Yes i've tried with property-ref on key and foreign-key on join but nothing changes in the sql generated.
First of all, thanks for your time.

I already try this but

- this needs an association table;
- this needs a POJO that maps the table Locale;
- this searches for a java.lang.String map

Just annoying...
So base on this about key

It appears anywhere the parent mapping element defines a join to a new table that references the primary key of the original table


ther's no way to have

insted of


The only solution is to use a ono-to-one and create the Locale Pojo?
I think that my situation is similar to the one in the example

where PERSON is my RESOURCE and ADDRESS is my LOCALE, and in RESOURCE ther's ID_LOCALE that refers to ID of LOCALE or I'm wrong?
Anyone? I just don't want to create a Locale POJO for a read only information like the locale code, and the use a one-to-one association. I found that with hibernate annotation @SecondaryTable it's possible to do what I'm asking for, but exists an xml equivalent?

Thanks
Hi all,
I've a problem with hibernate xml mapping and join. This is my scenario:

Table Resource
id, Pk
code
message
id_locale

Table Locale
id, Pk
code
description

On the table Resource I've a fk on id_locale referencing the column id of the table Locale.

Java Side, I've created a pojo ResourceBean with getter/setter for id, code, message, localeCode and this is my mapping




When i try to retrieve a resource, the join fails in finding the column ID_LOCALE

There's something wrong with the on clause but I don't know how to correct it in the mapping.

Thanks