Java Solutions

Tuesday, July 16, 2013

JSF Reference Card

Programmatically Accessing values from Resource Bundle

public class JSFUtil {
   [...]
 
   public String getResourceValue(String key,String parameters[]){
     FacesContext context = FacesContext.getCurrentInstance();
     ResourceBundle rb =context.getApplication().getResourceBundle(context,"resource_bundle_name");
     String value = rb.getValue("key")
     return MessageFormat.format(value,parameters);
   }
}

updating...

Posted by amer sohail at 12:19 AM 0 comments
Labels: bundle, jsf, MessageFormat, programmatically, resource

Thursday, July 4, 2013

JPA Reference Card

Collection of basic types

Use @ElementCollection annotation along with @CollectionTable (if you want to control the name of table), and @Column (name of column to represent value of simple type)

@Entity
public class User {
   [...]
   public String getLastname() { ...}

   @ElementCollection
   @CollectionTable(name="Nicknames", joinColumns=@JoinColumn(name="user_id"))
   @Column(name="nickname")
   public Set<String> getNicknames() { ... } 
}

updating...





Posted by amer sohail at 12:04 AM 0 comments
Labels: @ElementCollection, basic, collection, hibernate, jpa, types
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Popular Posts

  • Batch Insertion in Hibernate
    Batch Insertion is a powerful feature of hibernate particularly useful when you are importing data from other systems in batch. If you do no...
  • Creating Custom Button in JavaFX
    JavaFX is an exciting new technology to create RIA for different platforms and devices like desktop, web, mobile, tv etc. JavaFX provides a ...
  • Doing some work before showing Popup in ADF
    Here is the way to do any processing before calling popup. First of all create a method in backing bean and assign this to action of "c...
  • JSF 2 Internals - Efficient way of Redirecting to a Page
    There are certain cases where you are needed to redirect  to a different page than requested by user e.g. if user has requested a secure pag...
  • Integrated Weblogic Server Domain
    I was developing an application on JDeveloper 11g and deploying it on intergrated weblogic server. In my application i was authenticating us...

Blog Archive

  • ►  2018 (1)
    • ►  March (1)
  • ►  2014 (3)
    • ►  September (1)
    • ►  March (1)
    • ►  January (1)
  • ▼  2013 (4)
    • ►  December (1)
    • ▼  July (2)
      • JSF Reference Card
      • JPA Reference Card
    • ►  April (1)
  • ►  2012 (4)
    • ►  November (2)
    • ►  October (2)
  • ►  2011 (7)
    • ►  November (1)
    • ►  March (3)
    • ►  February (3)
  • ►  2010 (2)
    • ►  July (1)
    • ►  May (1)
  • ►  2009 (9)
    • ►  December (3)
    • ►  October (5)
    • ►  May (1)
  • ►  2008 (10)
    • ►  October (1)
    • ►  August (1)
    • ►  July (3)
    • ►  June (3)
    • ►  May (1)
    • ►  April (1)

Visitors

visitors by country counter
flag counter

Followers

Simple theme. Powered by Blogger.