background preloader

Hibernate Mapping Cheat Sheet

Hibernate Mapping Cheat Sheet
A many-to-many reference is basically a collection. Class A holds a reference to a set of class B instances (as in the one-to-many case), but B might have multiple A's. Scenario We have two classes, Foo and Bar which are related to each other as follows: Set Foo.getBars() // of Bar instances<class name="Foo" table="foo"> ... <set role="bars" table="foo_bar"><key column="foo_id"/><many-to-many column="bar_id" class="Bar"/></set> </class> This time we cannot have an extra column on Bar as that would dictate that each Bar has only one Foo. Bidirectionality This relationship can be declared both ways, with Bar having getFoos(), by suitable code changes to Bar and the following schema change: <class name="Bar" table="bar"> ... Now your Bars will know who their Foos are. No extra columns are generated for the bidirectionality. If you want independent collections of Foos on Bars and Bars on Foos (i.e. membership one way doesn't imply the other), you need to declare Bar's table to be bar_foo.

Hibernate Querying 101 : tips and tricks This article presents a few real-life tips and tricks for Hibernate querying. It is designed to be a 'from-the-trenches' account of the methods and best-practices we use and that we have found to work. Background First a little background. We are currently working on a project using a JSTL / Struts / Hibernate / PostgreSQL stack. The application requires many PDF reports. The reports tend to be complicated. Hibernate Query Methods The queries we general use can be divided up into three main categories : Simple HQL queries using one class (where no joins are required) HQL queries which require joins over several classes HQL queries which cannot be efficiently done using joins Simple HQL queries The first and simplest query is the plain old HQL query on one object, as you can find in all the Hibernate introductory examples : from Sale sale where sale.date > :startDate This type of query is not really the subject of this article. Queries using joins Now lets go back to the previous query. or

perfection kills » Blog Archive » Prototype 1.6.0.2 Cheat Sheet A long awaited Prototype cheat sheet – a full reference to a bleeding edge 1.6.0.2 is finally here . I had no experience creating something like this before, so any bugs or suggestions are very much appreciated. Couple of notes about notations: Modules are sorted in a somewhat logical order – those commonly used are mostly in the left/center area, while deprecated/utility methods are all the way to the right Method can be recognized by parentheses following it (anything that doesn’t have ones is a property) Deprecated items are marked red and have NO parentheses/arguments specified Prototype extends quite few native objects’ prototypes with a set of convenient methods. When a module is also a class, there’s a “(constructor)” note next to it – i.g. There are few bonus items (such as those from Prototype.Browser) which are not yet included in documentation Update 2: Uploaded a Higher Contrast version ( 8203 downloads) Seems to look much better when printed. Great job. Good point! [...] [...]

Building a tag cloud in Java You've seen them. Maybe you like them, maybe not, but Tag clouds are here to stay (at least until someone invents something better). This article details how the tag cloud for this web site was created. This site uses Hibernate (with Annotations) and Spring extensively, but while this article will make use of those frameworks, the same general concepts apply no matter what frameworks you choose to use (or not use). The first step to bulding a Tag cloud is being able to map Articles to Tags (and vice-versa, which will be clear in a moment). private List<Tag> tags; @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }) @JoinTable( name = "article_tag_link", joinColumns = { @JoinColumn(name = "article_id") }, inverseJoinColumns = @JoinColumn(name = "tag_id")) @OrderBy("displayName") public List<Tag> getTags() { return tags; } It might not be immediately obvious, but we need to map Tag objects to Article objects as well, in order to make our Hibernate queries easier to write.

Reader Pick: 12 Excellent Websites to Follow if You&#039;re into Web Design - Six Revisions The easiest way to keep up with the latest news and resources is by subscribing to RSS feeds of your favorite sites. When I wrote an article called "30 Websites to follow if you’re into Web Development", I knew I couldn’t include everyone’s favorites, so I asked readers to suggest other websites worth following. This is a collection of just some of your suggestions. 1. Suggested by: Matthew Adams of 101PoundWebsite.com, David Lano of David Lano’s Blog, Jake of DesignerFied.com, and Nodster CSS-Tricks is a site by Chris Coyier that shares information about CSS tips, tricks, techniques, and news. 2. Suggested by: David of DevKick DevKick focuses on web development articles geared towards web designers. 3. Suggested by: John Campbell of Design Bump Design Bump is a community-driven social media site dedicated to design – much like Design Float and DZone (for developers). Design Bump Popular feed 4. Suggested by: aleeesha Design Melt Down discusses trends and issues pertaining to web design. 5.

The Best Developer Cheat Sheets Around | Webmasters by Design The Best Developer Cheat Sheets Around Who doesn't like a helpful cheat sheet to have around? They save so much time and really help you learn what you are working with in an easy to understand format. DesignHTML (1) (2) (3)CSS (1) (2) (3)XML (1) (2) (3)RGB Hex Color (1)DOCTYPE (1)ProgrammingPHP (1) (2) (3)ASP (1) (2)JavaScript (1) (2)Ruby On Rails (1) (2) (3) (4)Perl/CGI (1) (2)Ajax (1) (2) (3)DatabaseMySQL (1) (2)PostgreSQL (1) (2)SQL Server (1)Oracle (1) (2)OtherRegular Expressions (1) (2) (3)mod_rewrite (1)htaccess (1)RSS (1)WordPress (1)CHMOD (1)Vi (1)Social Bookmark Links (1)SEO (1) For even more resources check out this blog post on the Virtual Hosting Blog. Update Hey everyone. What cheat sheets did I miss? 40 Comments

CSS Layout | layers, absolute and relative positioning and floating elements || HTMLSource ] Path // → → CSS LAYOUT One of the major benefits of using CSS is that you’re no longer forced to lay your sites out in tables. The layout possibilities of CSS give you complete control over the positions and dimensions of all page elements. If you’ve tried laying out a page with tables, you have probably been irritated in the past by the inability of your browser to render your page exactly as you had wanted. Table structures aren’t the most flexible of page layout devices, as they weren’t really designed for this purpose. Now however, with some reliable browser support in the current generation of browsers, you have a new and much improved option. This page was last updated on 2012-08-21 Working with divs The <div> element is well-suited to take over from tables as a layout tool. The div tag has few attributes of its own (save for align="left | right | center"), with all of its formatting applied through stylesheets. <div id="navigation">...navigation links... Floating Elements Column 1

Practical CSS Layout Tips, Tricks, &amp; Techniques The Web Standards Project’s (WaSP) Browser Upgrade Initiative (BUI), has spurred many a designer to move towards more standards compliant web design, using CSS rather than tables for layout to save user bandwidth while enhancing underlying semantics, accessibility, and reach. “Tables are dead…”#section1 Several designers have taken Jeffrey Zeldman’s lead in posting tutorials that have helped us get over the initial hump of table-less design. The first efforts have focused on creating two or more columns using CSS positioning instead of tables, thus allowing for a (complete) separation of structure from presentation. Others have chimed in, including Owen Briggs’ Box lesson and Tantek Çelik’s box model hack/workaround, detailed by Eric Costello, and explained by Tantek. “...Long live tables”#section2 The question#section3 Suppose you want to have a bunch of thumbnail images that link to larger versions of the images – a fairly common type of web page. One Step at a Time#section4 And the HTML:

Cheat Sheets for Front-end Web Developers Cheat sheets are helpful to have around because they allow you to quickly remember code syntax and see related concepts visually. Additionally, they’re nice decorative pieces for your office and can prepare you for client questions regarding web development. In this article, you’ll find 23 excellent, print-ready cheat sheets for HTML/HTML, CSS, and JavaScript (including MooTools and jQuery). So go ahead – print out your favorites and pepper your workspace with these wonderful references. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. JavaScript 12. 13. 14. 15. 16. 17. mootools 1.2 cheat sheet 18. jQuery Cheatsheet 19. jQuery 1.2 Cheat Sheet 20. jQuery Visual Map – PNG Miscellaneous 21. 22. 23. These are great resources regardless of the size of your clients.

Ruby on Rails Cheat Sheet - Cheat Sheets - Added Bytes A quick reference guide for Ruby on Rails, containing the default directory structure, predefined variables, methods, reserved words and regular expression syntax. The Ruby On Rails cheat sheet is designed to be printed on an A4 sheet of paper and live by a developers desk, to make life a bit easier. A description of what is on the cheat sheet follows, or if you are impatient, you can go straight to the full size Ruby On Rails cheat sheet. I am no expert in Ruby, On Rails or off, so to ensure this cheat sheet was as useful as possible, I pestered the very helpful Amy Hoy of (24)Slash7 and David Heinemeier Hansson of Loud Thinking into giving me a hand. Default Directory Structure Ruby on Rails by default uses a rather large selection of folders and files, organised into a directory structure. Pre-Defined Variables Ruby on Rails, like most languages, includes a large number of predefined variables. Reserved Words Regular Expression Syntax Methods Download Related Cheat Sheets Python

Git cheat sheet Due to the fact that I've been moving I forgot to point out that about three weeks ago I created a small Git cheet sheet. Quoting my email to the Git mailing list: I took a short break from being insanely handsome (which takes a lot of my time - gorgeous doesn't just happen) and based on similar work for Mercurial created a little SVG cheat sheet for Git. I'm not sure if it's going to be useful for anyone else (the target audience was composed of engineers who agreed to move to and work from Norway so you know right of the bat that historically they already made some bad decisions), but the times when I do art are so rare that I feel the need to share. The thing that I took from the Mercurial sheet, besides the idea, is the flow-chart (people dig icecream and flow-charts, the first one is really hard to get into a SVG rendering so I went with the second) so the license is the same as of the Mercurial sheet which was Creative Commons.

18 Seriously Helpful Cheat Sheets for Easier Coding | Web Design Ledger A few weeks ago, I showed you the best cheat sheets for web designers. Following that post, many of you showed interest in having cheat sheets to help you write code. That is no surprise since the skill set of many web designers today go beyond visual design. So whether you are a seasoned programmer or just starting to learn how to code, these cheat sheets are going to be a big help to you. WordPress The WordPress Help Sheet The Advanced WordPress Help Sheet ExpressionEngine ExpressionEngine Quick Reference Chart PHP Cheat Sheet MySQL Cheat Sheet Ruby on Rails Ruby on Rails Cheat Sheet JavaScript JavaScript Cheat Sheet Scriptaculous Cheat Sheet jQuery 1.3 Cheat Sheet mootools 1.2 cheat sheet Prototype 1.6.0.2 Cheat Sheet (X)HTML Elements and Attributes HTML/XHTML in one page CSS Cheat Sheet (V2) ActionScript Actionscript 2.0 Cheat Sheet Flashpaper ActionScript 2.0 to 3.0 Migration Cheatsheets Papervision 3D Cheatsheets Other resources About the Author Related Posts

18 Seriously Helpful Cheat Sheets for Easier Coding A few weeks ago, I showed you the best cheat sheets for web designers. Following that post, many of you showed interest in having cheat sheets to help you write code. That is no surprise since the skill set of many web designers today go beyond visual design. So whether you are a seasoned programmer or just starting to learn how to code, these cheat sheets are going to be a big help to you. Wordpress The WordPress Help Sheet The Advanced WordPress Help Sheet ExpressionEngine ExpressionEngine Quick Reference Chart PHP Cheat Sheet MySQL Cheat Sheet Ruby on Rails Ruby on Rails Cheat Sheet JavaScript JavaScript Cheat Sheet Scriptaculous Cheat Sheet jQuery 1.3 Cheat Sheet mootools 1.2 cheat sheet Prototype 1.6.0.2 Cheat Sheet (X)HTML Elements and Attributes HTML/XHTML in one page CSS Cheat Sheet (V2) ActionScript Actionscript 2.0 Cheat Sheet Flashpaper ActionScript 2.0 to 3.0 Migration Cheatsheets Papervision 3D Cheatsheets Other resources

Related: