Sol Mayer-Orn

Ranch Hand
+ Follow
since Nov 13, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Sol Mayer-Orn

Hi,
I'm using JPA with Hibernate implementation (but a solution on classic Hibernate would also be appreciated).
It's a Many-to-Many unidirectional relation, say between "Course" and "Student" (code below).
My problem is saving a Student when his Courses list is detached. I'm sure each such course is already saved in the database and has proper ID... so I wanted to just update the JoinTable without wasting performance on checking the existence of each course. I could do it easily with raw JDBC. But if I use Hibernate, it forces me to check and "re-attach" the courses (re-attaching is either through CASCADE, or re-selecting the courses).


Is there a way to tell Hibernate to "just trust me &update the JoinTable (linking this studentID to those courseIDs), without reattaching/validating each course?

Thanks

Sam Mercs wrote:Seems like a pretty rare off use case to me ....



Thanks for replying.
I actually suspect many people run into this problem....
The "greeting text" example was just for simplicity. In reality, our resources are vendor-specific configuration files, required for various 3rd-party tools.
E.g. you may have some 3rd party called "AnnoyingCacheManager", and in order to configure itself it expects an InputStream to a vendor-specific xml file, such as:
<annoyingManager><thePort>8000</thePort></annoyingManager>

Naturally I'd <thePort> to be configurable through Spring.
Now if I'm lucky, AnnoyingCacheManager might be "Spring ready" (have explicit Spring support, or some useful setters).
But some of our esoteric vendors just expect this rigid XML format
So I'd like Spring to prepare the required stream based on some template.

Thanks anyway for replying.
12 years ago
Hi,

Does anyone please know of an implementation of ClasspathResource which supports "property placeholders" inside resource text?
For example, say I have the following text resource in my classpath:


Now I'd like to inject this "ClasspathResource" into a bean that reads it, but it should read "Hello mister JOHN" , replacing "${username}" with "JOHN" (based on some properties file).


Is there such an implementation? Or should I write my own ("MyResource implements Resource")?
Thanks
12 years ago
Thanks a lot for the replies
13 years ago
JSF
Hi,

I'm relatively new to JSF (using JSF 2.0).
I have no problem generating HTML files, but now ran into an unusual situation where I need to dynamically generate a *javascript* file.
Something like:


I'm aware there are other solutions, but I'm not crazy about them:
- inline my javascript inside the HTML page:
- pass 'var a' as a parameter: f(a)

But i'd rather generate a separate (dynamic) javascript file (because our real-life javascript is complex, so the generated HTML would be less readable if we inline javascript into it... and in reality we don't have a single parameter "var a", but dozens of them, which is ugly to pass).

Is it possible to do via JSF?
Or would it be better to make it a JSP (just for this javascript file)?
Thanks.
13 years ago
JSF
Hi,

I'm very new to grid computing, and would appreciate help on the following:

Say I have 2 subsidiary companies, belonging to the same corporation, and I want to manage their personnel database.
Now, most of the time, this can be 2 separate instances of the application, unrelated and un-clustered: each company will manage its own people, on its own application server and its own database, with no interest in the other company. I don't want to put them on a cluster and replicate data, because it's slower, harder to manage, and with little benefit (I don't need backup nor fail-over).

However, once a week I want to issue a "shared" report on the 2 databases, as if they were one (running statistics on salaries, sick days, etc - for the 2 companies together). I can make sure the databases are logically easy to merge (e.g. each company has its own range of IDs, to avoid conflicts).

Are there any tools to issue such 'merged' reports with Java? Either in JDBC level (JDBC driver that connects to 2 databases simultaneously), or some higher level grid-computing tools?
Thanks.
15 years ago
Hi,

I'm writing my first "Eclipse Plug-in Project" (on Eclipse 3.4, such a project is created through File->New->Project->Plugin Project). In my case, it's an OSGi bundle.
My question is: my "Eclipse Plugin Project" needs to use(import) some utility code from an old standard Java project (created through File->New->Project->Java Project).
Now, I know I could manually package the "Standard Java" project into a jar, and add the jar to the "Plugin Project"... but can I get Eclipse to do it for me, instead? I tried defining a project dependency in eclipse (through project Properties->java build path->Projects), but it acts weird: the code complies, but crashes when I run it, complaining it can't find the class.

Thanks
Hi,

I'm trying to do Table Pagination with Struts2. I found some discussions in this forum, but they're over 6 months old, and they all say Struts2 has no dedicated support for Pagination (though it's not very difficult to write "home made" code).

Does anyone know if there are news or improvements on this, like:
- Dedicated Struts2 tags (added in newer versions)
- Dedicated Dojo widgets
- Formal recommendations from Struts2 team?

Reminder - by Table Pagination, I mean breaking a large table into several pages (say a 500-records table can be broken into 25 pages, with 20 records per page).
The user should be provided with a widget for selecting the page, something like:
<< 1 2 3 4 5 ... 24 25 >>


Thanks very much.
[ May 18, 2008: Message edited by: Sol Mayer-Orn ]
16 years ago
I'm new to ejb, and trying to use @NamedQuery.
When you declare @NamedQuery (using annotations, not XML), do you have to declare it on an @Entity class ?

I mean:

I couldn't get the second example to work.
I even tried declaring the NotEntityClass in persistence.xml, but it didn't work - maybe I did it wrong ?
<class>somePackage.NotAnEntity<class>

Is there some way to make it work ?
Thank you.
[ October 03, 2007: Message edited by: Sol Mayer-Orn ]
Hi,

I've just started using JPA, and would appreciate it if anyone could help with the following question:

What is the recommended way to define a conversion rule between my database data, and my Java data ?
For example, say my (badly designed) database stores string values of "YES" and "NO", which I'd like to convert to java boolean :


What is the most recommended way to do the conversion ?
Thanks
[ September 30, 2007: Message edited by: Sol Mayer-Orn ]
Thanks for this clarification.
And extra thanks for taking the time to reply in such detail

In my case, Jesper Young's reply did the job just great, just what I've been looking for.
But I agree that in general, it's very important to investigate as many options and alternatives as possible.
17 years ago
Thanks, Roger Chung-Wee, for this reply.
The factory approach sounds good - neat and flexible.

But in that case, could I just shift my question a little: how do you make the *Factory* available to the Session bean ? Is your factory just a static method (or static singleton) ? Or is your factory a Local session bean ? etc.

Thanks again
Thanks for the excellent reply and the link.

Can I just ask: how do you make the DAO available to the Session bean?
I'm considering 3 alternatives (see below).
Which seems most reasonable, in your experience ? Or do you have a different, better approach?
Thanks again.

Options I was considering:





[ September 26, 2007: Message edited by: Sol Mayer-Orn ]
I liked both
Manning's "Ejb 3 in action"
Wiley's "Mastering EJB 3.0"

The "in action" book is shorter, and takes a more "hands on" approach, though it's still very careful in making sure you understand what you're doing.

The "mastering" book is longer, and tends to go into more detailed explanations. Some of them are over-verbose, while others really gave me a little extra insights.