Victor Dolirio

Ranch Hand
+ Follow
since Aug 21, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Victor Dolirio

Hello everybody,

I'm in a situation where I needed to create an UserType that have 2 columns. So far so good. Every entity needs to map this type with a @Columns specifying column names.
But one of my entities have an embedded component which, in turn, have 2 fields of this type.
The intuitive solution is to map the entity with @AttributeOverrides with the columns specifications on the component field. This solution doesn't work for me. I've searched for this problem and haven't found nobody with this kind of trouble. I'm using hibernate 3.6.9.

Another solution I know that would resolve this is to retire the UserType kind of mapping and pass to use @Embbedable. But this solution will require more changes.

Does someone know a solution to this?

[]s,
Victor Dolirio
Can you post the complete stack with the error? Post also the complete code of the query execution...

Thnx
You might configure hibernate programmatically instead of use .xml configuration. Thus your password go in bytecodes. It ain't the most secure approach but give you a better security. It gives you also more flexibility like the possibility to call security methods...
You might blend up xml configuration and java code configuration too.

best regards.
Kjeld, IMO hibernate by itself ain't the problem. Think in your dbms side: is it possible to insert a new record this way without violate the FK constraint? Maybe is possible if your dbms use sequences, you can get the sequence before insertion and set up both field of you bean: id and 'parent' reference. Just map your bean to have indetity controled by you and you can write a interceptor to get next value from sequence and fill the fields. Its just a suggestion.

hope be helpfull...
My apologies, I confess that I don't have undertood correctly your question, but now, with a better read I've got a better understand. IMO, isn't it is a paradoxical concept?? How could one element it self be your own parent? This is worst than "Which came first, the chicken or the egg?". But regardless of my humble opinion, I think that you can accomplish this in two steps: first, saving the entity without parent (to have the hibernate make the identity of the entity) and then update this entity supplying the parent entity to it self. I don't know if that is possible to do it in a single step.

For sake of curiosity, which is the reason that towards you to have a element being a parent to it self?

best regards.
You can do something like the following code snippet:



I hope to help.

[]s
Nice! It's exactly what I need! Simple and agile.

Thanks all you!
14 years ago
JSF
Hi Tom, thanks, this was just what I wanna hear. I hate to do complex actions to accomplish simple requirments. I'll be more thankful if help me to understand what you say with an example.

I have a entity named "Event". This entity have a datetime to the begin and other to the end of the event. If user open the view page of this event just in the time this event is happening, I need to put a style in the label of the caption of the event, as follows:

CSS style:


code snippet for the Page:


What I would do to apply the css class if event is happening just in the time the user open this page? (don't worry with logic of dates, I just wanna know what to do with JSF).

Best regards,
14 years ago
JSF
It's possible to call a method of backingbeans, triggered by arbitrary events on lifecycle of request? i.e. I want to call one method on my backingbean when restore view phase has been done.

My intention is to update components state, behaviour or fashion (in my backingbeans), on the startup of my pages, depending on model state. i.e. Set some css style on certain components if business rules require it when use open a page.

Currently, I'm picking these behaviours in set and get methods of my backingbeans... Some help?

best regards,
14 years ago
JSF
I'm suposing that you are asking rather than stating (despite you don't write it this way ;) ).

1st) The name of configuration file can be what you wanna it be. Once you'll declare it in the configuration model (i.e. hibernate.cfg.xml). But it's a convension to use NameOfBean.hbm.xml.

2nd) You can have as many configurations as you need to a single Bean. Despite I never had seen a true need for this in real (large) projects. Just be careful to duplicate Entities in you configuration model.

I hope be useful.
It's used to map value types in your entity. You must understand the difference between the concept of entity and the concept of value types to decide correctly whether to use value type or a entity in your maps.

I hope to be useful.
Daniel,

Thanks for regards. Could I call this method without an user action? i.e. When the user enter the url in browser, before it gets rendered?

[]s,
Victor Dolirio
14 years ago
JSF
Hi ranchers,

When I'm using my backed bean in scope session, there are centain situations that I would like to create a new instance of this bean in the session. Something like to restart the "state" of my bean. There is a direct way (via jsf api) to accomplish it? I'm wondering if exists a way to do this directly in the pages or in a declarative way...

[]s,
Victor Dolirio
14 years ago
JSF
Have you already tried to use the "with" keyword? I'm not sure if this keyword might work cause I never had used it in inner joins. Try somethink like the folowing as a matter of taste...

I won't comment about any other frameworks but I'm currently using Apache Wicket and it is being much usefull to me. I recomend ;)

Anyway there are a really wide of possibilities of frameworks for this purpose. Just take a google on it.