Tanya Ruttenberg

Ranch Hand
+ Follow
since Jun 22, 2009
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 Tanya Ruttenberg

I really appreciate the info about DataModel. I like to do things "correctly" (ha! whatever that means) and I like transparency.
I prefer to create my own DataModel rather than have one show up.

And yes, I was refering to richfaces regular DataTable rather than richfaces extendedDataTable.

I'm working on a pilot project to bring myself up to speed on JSF2 and the other related hibernate 4 and richfaces 4. I am self-taught and there is SO MUCH I don't know it's really hard sometimes.

TDR
7 years ago
JSF
Thanks Tim. After thinking about this a bit I realized I do want to sort the ENTIRE list and not just the part that is displayed.

You are right -- I'm using ArrayList behind the dataTable. I'm not sure how to use DataModel as yet, but I'm going to look into it. I'm not sure I have to when all I want to do is sort. Plain dataTable does do sorting as well. You don't need the extended version. It's got some nifty features, but I'm not sure I want those. For now trying to keep it simple.

Once I've figured out what I need to do I'll post my results. Didn't want you to think I disappeared into the ether like posters sometimes seem to do.
7 years ago
JSF
I have a richfaces dataTable that is populated by fetchDevices() which runs a sql query. I want to be able to sort the table without re-running the query.
How do I do that? Is that what client-side processing is all about? Doing stuff just on the client? I use a DeviceSorting bean to determine sort order.
Can I use a java bean on the server to calculate sort order without re-running my fetchDevices() query?

According to richfaces showcase I can use javascript API .sort('columnId', ['sortOrder']) to do this, but I know almost no javascript so I don't have any clue how to do that.

Here's my richfaces code.



TDR
7 years ago
JSF
I have a simple java program. There are 10 classes, 4 of which are @Entity beans using hibernate 4 to interface with the database. It runs the old-fashioned way from the command line, eg "java -jar myapp.jar". When I implemented hibernate in this app I followed some rather old examples that include a HibernateUtil.java class.



Hibernate sessions are grabbed via



boilerplate stuff, as far as I can tell.

It works fine the way it is, but I decided to re-design the thing using CDI. I'm wondering if there is some nifty, new way to grab those hibernate sessions, maybe using CDI? But this is not an J2EE app, there is nothing enterprise-y about it. When I try to inject a persistence context or entity manager it comes up "null". And I can't find a single discussion or example of doing this that is not a J2EE app.

Is it possible to acquire a hibernate session using CDI or some other nifty annotation in a plain old java program? Or is this only possible in a J2EE context?

Am I misunderstanding something fundamental? (would not be the first time!)

TDR
7 years ago
Hi - I had a similar question on stackoverflow

http://stackoverflow.com/questions/9861144/why-is-my-viewscoped-bean-not-surviving-hcommandbutton

the answer to the question is related to the @Named vs @ManagedBean discussion.

TDR
7 years ago
JSF
Here's what I ended up learning and doing.

1) I learned that you don't need hbm.xml files to use hibernate -- that was a relief. You can use the hibernate annotations on a pojo to map a class and its attributes to a table and its columns. Because I had never used plain hibernate before, I had confused hibernate with EJB. (I guess I'm still mystified as to what EJB adds or even is, but that's another discussion).

2) This is a good resource http://www.mkyong.com/tutorials/hibernate-tutorials/ Very easy to follow (if a bit outdated) tutorials/examples.

3) I created a maven/hibernate project using maven-archetype-quickstart and then more or less followed this tutorial http://www.mkyong.com/hibernate/maven-3-hibernate-3-6-oracle-11g-example-annotation/ substituting mysql for oracle.

It turned out to be so simple and now I can use this as a boilerplate for other small tasks that I used to accomplish in perl.

Thanks,
TDR
7 years ago
Once this script is written it will be run daily, but a script _like it_ will not have to written again.

The thought of writing those mapping files is a bit daunting as there are relationships that have to be maintained etc.

Still trying to figure out what to do -- I may use hibernate anyway just for the experience.

Thanks again.
TDR
7 years ago
Oh got it. Just plain POJOs with Hibernate.
That makes sense.

(I think I was conflating hibernate with ejb)
7 years ago
Thanks for replies --

The reason why I think "EJB" is that I want to use an ORM framework to interface with database tables.

I was originally going write this script in perl and using the RoseDB ORM framework makes putting the data into the database SO much easier than using SQL queries. Is that not also true in Java? I assumed it would be, but maybe not. I think my head is stuck in the perl paradigm and I'm missing something fundamental about the java paradigm. I don't know.

I don't understand why EJB is more appropriate for a web application than a batch job. Isn't the bottom line that you use EJB when you want to solve the problem of classes interfacing with database tables?

Hope someone has more to add, because I'm still confused.
TDR
7 years ago
In the past I've created more-or-less boilerplate web apps using seam-gen and then did some basic enhancement. I did not have to figure out how to structure the project. I am not a well-eduated developer (former sys admin and mostly self-taught) and there are some gaps in my knowledge.

I now want to create a simple batch job in java that would use a specific vendor API to get data from a proprietary database and plop it into mysql so the general public has access to it. How do I structure and run it? I have this idea to use EJB3 entity beans as an interface to the database, but I have no idea how to incorporate it into a simple project like this or even if it is possible to use it in this context.

Hope I've provided enough information. I can't figure out how to get started.

Thanks
TDR
7 years ago
I don't understand the concept of type safety.

I recently implemented metamodels to build queries with the criteria api. Metamodel use is recommended for "type safety." It was a challenging and interesting to build these in maven and eclipse, but I'm not sure why I did it. What is the difference between this:



and this:



?

TDR
8 years ago
Forget the question. I figured out the best way to do this is encapsulate the logic



and in the view

8 years ago
JSF
I am moving into J2EE 6 from Seam 2 framework. I think this is a simple question, but I can't quite figure it out.

How do I make the equivalent of an out-jected context variable with CDI/JSF2?

I want to make conditional rendering based on a number of items, which should be constant and hard-coded;



How do I access MAX_ALTERNATES from my view more or less like this?



I want MAX_ALTERNATES to be accessed when it is needed, like a factory variable.

TDR
8 years ago
JSF
I am relatively new to java web programming. I first learned how to do this on seam 2 with a seam-gen generated app. It's taken me awhile, but I finally realized that seam 3 is not exactly a shiny new version of seam 2, and that what I used to think of as my "seam app" is, in the next generation of j2ee, a "j2ee 6 app".

With that said, I have embarked on my first j2ee 6 app today. It's a new paradigm and I'm trying to figure it out.

One thing that is driving me nuts is that I keep getting a view expired error message! My app has one page, index.xhtml. It has an input field for a form. Every time I re-deploy I get the view expired exception and the most reliable way I've figured out how to get rid of it is to open a new tab. Obviously not the end of the world, but it's very annoying.

Why did this never happen with my seam 2 app, and how can I get it to stop in my j2ee 6 app! I sense that in the Brave New World I am relying on JSF for presentation which is historically a POST-oriented framework, and previously I relied on seam 2, which is a GET -oriented framework. Or something like that.

Based on other questions I've seen on forums, I sense this paradigm shift is confusing a lot of begining/intermediate level developers who first learned their trade on seam 2.

My index.xhtml



and my managed bean, or backing bean, or whatever the heck it is. It's a java class in any case :-)



I've got an Entity bean called Doors.java. I'm not going to post it because it doesn't contain anything interesting.
I'm deploying Jboss AS 7 if that matters.

Thanks for any help.
TDR
8 years ago
I have a seam application. I am using the debugger to inspect various components.

When I launch the app by entering a URL like this DevicesList.seam?state=MD&city=BALT the parameter map, retrieved thusly:


contains key,value pairs that are nice and predictable: Key: state, value: MD, key: city, value: BALT.

But when I launch my app on the "search page", enter MD in the state field, BALT in the city field, that same parameter map looks nothing like it. The keys look like the id's of the input fields, rather than like the parameters.

Two questions -- what is the difference? I'm guessing it has something to do with GET and POST? Just ignore that if I am completely off-base.
And how do I retrieve the nice and predictable parameter map? This has to be stored somewhere in the FacesContext or ServletContext or something?

I feel I am babbling like an idiot. I hope someone on this awesome forum understands my question. :-)
Thanks,
TDR
8 years ago
JSF