Sebastian Janisch

Ranch Hand
+ Follow
since Feb 23, 2009
Hamburg, Germany
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sebastian Janisch

Hey :-)

For the filtering of customer data in a CRM System I was wondering if there are any well established approaches or libraries available.

The concrete requirements are pretty straight forward.

On the web-frontend, a table shows a list of basic information of customers, such as name, phone, email etc. Pretty much a one-to-one display of the database table.

All available columns shall have the functionality to filter on them, e.g. restrict the name to "John Doe" and the zip code to "91423".

How would that on the other end be translated into a hibernate query. I could manually translate it using the Criteria or Filter API, but that seems a cumbersome thing to do.

Looking forward to hearing your advice
Sorry for posting three times. My browser acted weird.
Hi ...

I am facing some issues when mapping a dependent composition in hibernate and would appreciate some advice .

Here is the case:

A person can have several favorite cities. So, the relational model looks like this.

What I want now is a domain model where I can obtain a set of Favorite Cities from the Person object, like this.

Now for the FavoriteCity object, I don't want the Person to be referenced in it (to prevent the cycle and also because FavoriteCity is dependent on Person - no person no city).
Also, when adding a city, i don't want to associate the city with the person to then add the city to the person. From a domain driven perspective, this doesn't make much sense, as the relation to the person in implicated by the person to whom the city is added.

So, what I don't want is:

Instead I want:

The problem now is that I am not sure how this would be mapped in the hibernate mapping.

Hope anyone can assist

when I pull a record from the database using Hibernate, is there a way to validate whatever is written into the domain object?

I am using field injection, as i am using a domain driven approach. now if let's say a field is required to be not null, how would i validate that after hibernate invokes the private no-arg constructor and injects all fields, that field really is not null?

thanks for your help

hi Rajit,

thank you for your reply.

using the sequence, the whole thing works just fine :-).

best regards

Hey there,

Hibernate is trying to get me angry again.

I have a very simple setup. One Postgres table, which looks like this:

One domain class:

one mapping file

The property is set to 'validate'.

when i run the following code ...

the following output is given:

for some reason, hibernate can't see the blub property in the database table and it doesn't give me any hint what the proplem is.

hope anyone can help.

thanks - sebastian
Hey there,

I am facing a problem when mapping domain classes to a database table in hibernate.

I am following a domain driven approach, so a class would look like this:

Now, is there a common way to map domain values to their corresponding database columns?

what i have done so far is using the <component> element like this

and this works. however, i also use domain values for id properties that are usually mapped like this:

this expects a primitive id type, such as Long. However, if I used the type MessageID as a domain value, i don't know how to do the mapping, as the component element does not support an id element in it's body.

Hope somebody can help.

Best regards

Hey there,

let's say i have two line charts, represented by double arrays:

What I am looking for is a library (like apache commons math for statistical purposes), where I can punch in the two line chart and retrieve diagnostics, such as intersection points, etc.

Does such a library exist?

Thanks :-)
6 years ago
hey guys.

i am facing a little problem with bean definitions and i yet have not found a charming solution for this.

here is the project's structure:

- there is one project that contains DAO classes (no ORM, simple implementations using the spring jdbc template).
- those DAOs are referenced within the project by it's interface and autowired, which works fine so far
- now the application needs to run in a different context (which also introduces a new maven project which is only loaded when running this context), and we need to swap the implementation of one DAO. the most simplistic approach (which is the one we use now) is to simply override the bean definition in the newly introduced project. this works but seems very fragile to me, as there is no aid when changing the ID names of one of the beans which would cause erratic behavior.

is there any charming solution to this?

6 years ago
Hi there

there @Primary was what I was looking for.

I don't like using the @qualifier annotation, as the service consuming component should not know any of the implementation details. and narrowing down the component dependency using the @qualifier annotation kind of transfers this knowledge.

Thanks for your help
6 years ago
Hi :-)

let's say I have two different implementations for one interface, which are both published into the spring IOC container.

When another class references this interface using the auto wiring mechanism, and I fire up the application context, the whole thing blows up because spring does not know which implementation to inject.

Is it possible to specify a default implementation which is to be used in such case?

thanks for your help guys

6 years ago

I have found a solution to get it working.

Here is how:

6 years ago
ah, okay.

I thought that the ClassPathAppContext scans the class path to find all files that match the pattern.

It works id I do the following.

in the services-context.xml

That works and is acceptable I guess, even though the scanning variant would be more elegant.

There has to be a way to get this working, after all all those frameworks scan projects for spring files.
6 years ago
yes, this works fine. but it's not what I want.

What I would like is all context files that are located in any project under spring/*-context.xml to be part of the application context, without having to add them to the list of context files.
6 years ago