2008-01-01ãã1å¹´éã®è¨äºä¸è¦§
åã«ä¸åº¦ãã£ãã®ãä¹ ãã¶ãã«ããã¨ï¼ã¾ãã¯ã¾ã£ãã»ã»ã»orz ãªã®ã§å¿ããªããã¡ã«ã¡ã¢ï¼Rails ã§ãã¼ãã«ã®å¤å¯¾å¤ã表ãããã«ã¯ï¼has_and_belongs_to_many ã使ãï¼ä¾ãã°ï¼Person 㨠FavoritThing ã¨ããã¢ãã«ããã£ãã¨ããï¼Person 㯠FoveritThing â¦
hibernateã§ãããã³ã°ãè¡ãã¨ãã«ãå¤ãæå®ããªãã¨ããã©ã«ãå¤ã使ããããã¨ã³ãã£ãã£åï¼ãã¼ãã«åãããããã£åï¼ã«ã©ã åãªã©ãããããã£åãé·ãå ´åãä¾ãã°ãfirstName ã¨ããããããã£ããã£ãå ´åãããã¯ãã®ã¾ã¾ firstName ã¨ããã«ã©â¦
ãªãã¡ã¬ã³ã¹ã¬ã¤ãã®2ç« ã¾ã§è¨³ããã¨ããã§ãããããå®æ¦ã«ä½¿ã£ã¦ã¿ããã¨ãã¦è²ã ã¯ã¾ã£ãããã®æªæ¦è¦éã®ã¡ã¢ãå¾ããæãã°ãhbm2ddlã®ããã§ã¯ã¾ã£ãã¨ããããã hbm2ddl Hibernateã®ãããã³ã°æ å ±ããããã¼ã¿ãã¼ã¹ããããã¹ãã¼ãï¼SQLï¼ãä½æâ¦
2.2.6. Mapping composite primary and foreign keys | ç®æ¬¡@SecondaryTable ã @SecondaryTables ãã¯ã©ã¹ã¬ãã«ã«ä½¿ããã¨ã§ãä¸ã¤ã®ã¨ã³ãã£ãã£Beanãè¤æ°ã®ãã¼ãã«ã«ãããã³ã°ãããã¨ãã§ããããããã«ã©ã ãç¹å®ã®ãã¼ãã«ã«ãããã¨ã説æããã®â¦
2.2.5.5. Association fetching | ç®æ¬¡ | 2.2.7. Mapping secondary tables>è¤å主ãã¼ã¯åãè¾¼ã¿ã¯ã©ã¹ã主ãã¼ã¨ãã¦ä½¿ãããã ããã@Id 㨠@Embeddable ã¢ããã¼ã·ã§ã³ã使ããããã¾ãã@EmbeddedId ã¢ããã¼ã·ã§ã³ã§ãããããä¾åããã¯ã©ã¹ã¯ Serialâ¦
2.2.5.4. Transitive persistence with cascading | ç®æ¬¡ | 2.2.6. Mapping composite primary and foreign keys>é¢é£ã¨ã³ãã£ãã£ã®ãã§ããã«ãå³æã¨é 延ã®ã©ã¡ãã§ã使ããããfetch ãã©ã¡ã¼ã¿ã¯ FetchType.LAZY ã FetchType.EAGER ãã»ããã§ããããâ¦
2.2.5.3.3. Many-to-many | ç®æ¬¡ | 2.2.5.5. Association fetching>cascade å±æ§ããå¤ã« CascadeType ã®é åãåããã¨ã«æ°ãä»ãã¦ããã¨æãããEJB3 ã®ã«ã¹ã±ã¼ãã®ã³ã³ã»ããã¯ãHibernate ã® æ¨ç§»çæ°¸ç¶åã¨æä½ã®é£éã«ããä¼¼ã¦ãããããã©ãã¡ãã£â¦
2.2.5.3.3. Many-to-many | ç®æ¬¡ | 2.2.5.4. Transitive persistence with cascading> 2.2.5.3.3.1. Definition å¤å¯¾å¤é¢é£ã¯ @ManyToMany ã¢ããã¼ã·ã§ã³ã§å®ç¾©ããããã@JoinTable ã¢ããã¼ã·ã§ã³ã§é¢é£ãã¼ãã«ã¨çµåæ¡ä»¶ãæ¸ããªãã¨ãããªãããé¢é£ãâ¦
2.2.5.3. Collections | ç®æ¬¡ | 2.2.5.3.3. Many-to-many> 2.2.5.3.1. Overview æ¦è¦ CollectionãListï¼é åºããã§ããªãã§ãï¼ãMapãSet ã«ãããã³ã°ã§ããããEJB3 ä»æ§ã§ã¯ã@javax.persistence.OrderBy ã¢ããã¼ã·ã§ã³ã使ã£ã¦é åºã¤ããªã¹ãã«ãããâ¦
2.2.4. Mapping inheritance | ç®æ¬¡ | 2.2.5.1. One-to-one> 2.2.5.1. One-to-one 2.2.5.2. Many-to-one 2.2.5.3. Collections 2.2.5.3.3. Many-to-many 2.2.5.4. Transitive persistence with cascading 2.2.5.5. Association fetching
2.2.3. Mapping identifier properties | ç®æ¬¡ | 2.2.5. Mapping entity bean associations/relationships>EJB3 ã¯3ã¤ã®ç¶æ¿ã®æ¹æ³ããµãã¼ããã¦ããã ã¯ã©ã¹æ¯ã®ãã¼ãã«æ¦ç¥: Hibernateã§ã® ã¯ã©ã¹é層æ¯ã«1ã¤ã®ãã¼ãã«æ¦ç¥: Hibernateã§ã® ã¸ã§ã¤ã³ãâ¦
2.2.2.2. Declaring column attributes | ç®æ¬¡ | 2.2.4. Mapping inheritance>@Id ã¢ããã¼ã·ã§ã³ã¯ã¨ã³ãã£ãã£Beanã®èå¥åãå®ç¾©ãããããã®ããããã£ã¯ã¢ããªã±ã¼ã·ã§ã³ã§ãã»ããã§ãããã©ãHibernateã§çæãããã»ãããããã@GeneratedValueã¢ãâ¦
2.2.2. Mapping simple properties | ç®æ¬¡ | 2.2.3. Mapping identifier properties>ããããã£ãããã³ã°ã«ä½¿ãããã«ã©ã ã¯ã@Column ã¢ããã¼ã·ã§ã³ã§å®ç¾©ã§ããããããã©ã«ãå¤ãä¸æ¸ãããã¨ãã«ä½¿ããã詳ãã㯠EJB3 ä»æ§ãåç §ã次ã®ããããã£ã«ä½¿â¦
2.2.5.2. Many-to-one | ç®æ¬¡ | 2.2.5.3. Collections>å¤å¯¾ä¸é¢é£ã¯ @ManyToOneã¢ããã¼ã·ã§ã³ãããããã£ã¬ãã«ã«å®£è¨ãããã @Entity() public class Flight implements Serializable { @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE}â¦
2.2.5. Mapping entity bean associations/relationships | ç®æ¬¡ | 2.2.5.2. Many-to-one>@OneToOne ã使ã£ã¦ãã¨ã³ãã£ãã£Beanã«1対1é¢é£ãé¢é£ä»ãããã¨ãã§ãããã1対1é¢é£ã¯3ã¤ã®æ¹æ³ãããããåã主ãã¼ãå ±æããæ¹æ³ãä¸æ¹ã®ã¨ã³ãã£ãã£ãå¤é¨ãâ¦
ç®æ¬¡ 2.2.2.1. Declaring basic property mappings. Basicããããã£ãããã³ã°å®£è¨ ã¨ã³ãã£ãã£Beanã®ã@Transientãä»ãã¦ããªããstaticã§ãtransientã§ããªãå ¨ã¦ã®ããããã£ï¼ãã£ã¼ã«ãã§ãã¡ã½ããã§ãï¼ã¯æ°¸ç¶åããã¨ã¿ãªãããããã¢ããã¼ã·ã§â¦
Chapter 1. Setting up an annotations project | ç®æ¬¡ | 2.1. Intro> 2.1. Intro 2.2. Mapping with EJB3/JPA Annotations 2.2.1. Declaring an entity bean 2.2.2. Mapping simple properties 2.2.2.2. Declaring column attributes 2.2.3. Mapping identiâ¦
Preface åºæ | ç®æ¬¡ | Chapter 2. Entity Beans> 1.1. Requirements å¿ è¦è¦ä»¶ Hibernate Annotations ã®å»ç©ã Hibernate ã® website ãããã¦ã³ãã¼ããã¦è§£åãã¦ãã ãã®ãªãªã¼ã¹ã¯ Hibernate Core 3.2.0 GA 以éãå¿ è¦ã ãã ãã®ãªãªã¼ã¹ã¯ Hibernateâ¦
Hibernate Annotations ã®ãªãã¡ã¬ã³ã¹ã¬ã¤ãã®æ¥æ¬èªè¨³ããªãã£ãã®ã§ããã£ãã訳ãã¦ã¿ããééãçææããã ããã¨ãããããã§ããåæï¼ http://www.hibernate.org/hib_docs/annotations/reference/en/html_single/Table of Contents Preface åºæ Châ¦
ç®æ¬¡ | Chapter 1. Setting up an annotations project>Hibernate ã§ã¯ãä»ã® O/R ãããã³ã°ãã¼ã«ã¨ãããªãããã«ãå¤æããããã®ã¡ã¿ãã¼ã¿ãå¿ è¦ã ãã Hibernate 2.x ã§ã¯ããããã³ã°ã®ããã®ã¡ã¿ãã¼ã¿ã¯ã»ã¨ãã© XML ãã¡ã¤ã«ã ã£ãããä»ã®é¸æè¢â¦
2.2.1. Declaring an entity bean | ç®æ¬¡ | 2.2.2.2. Declaring column attributes>æ°¸ç¶åããPOJO㯠ã¨ã³ãã£ãã£Beanã£ã¦ãã¨ã§ã@Entity ã¢ããã¼ã·ã§ã³ã使ãããï¼ã¯ã©ã¹å®ç¾©ã«ã¤ãã¦ãï¼ @Entity public class Flight implements Serializable { Long â¦
2.1. Intro | ç®æ¬¡ | 2.2.1. Declaring an entity bean>EJB3.0 ã¨ã³ãã£ãã£ã¯ãPOJO ã ããå®ã¯ãHibernate ã® æ°¸ç¶åã¨ã³ãã£ãã£ã¨ãããªãã ãããããã³ã°ã¯ JDK 5.0 ã®ã¢ããã¼ã·ã§ã³ã§å®ç¾©ãããããã¢ããã¼ã·ã§ã³ã¯ãè«çãããã³ã°ã¢ããã¼ã·ã§ã³â¦
Chapter 2. Entity Beans | ç®æ¬¡ | 2.2. Mapping with EJB3/JPA Annotations>ãã®ç« ã§ã¯ EJB 3.0ï¼ä¿ã«è¨ã Java Persistanceï¼ã¨ã³ãã£ã㣠ã¢ããã¼ã·ã§ã³ã¨ãHibernateã®æ¡å¼µã«ã¤ãã¦ã ãã
Mac OS X 10.4 ã«ã¯æ¨æºã§ SQLite ãã¤ã³ã¹ãã¼ã«ããã¦ããã®ã ãããã®ã¾ã¾ã§ã¯åé¡ãããããã http://wiki.rubyonrails.org/rails/pages/HowtoUseSQLite ããã®æå¾ã®æ¹ãQ: On Mac OS X (10.4/Tiger), Iâm getting an error during migrations: ã«æ¸ãâ¦
ãRailsã«ããã¢ã¸ã£ã¤ã«Webã¢ããªã±ã¼ã·ã§ã³éçºã第ï¼çã«ãã£ã¦rails2.0ã§ãã£ã¦ã¿ããï¼ç« ã®ãã¥ã¼ããªã¢ã«ããã ã¡ãªã¿ã«ãrails2.0ã®åèããã®ã¯ãhttp://api.rubyonrails.org/ 6.1 ã¤ãã¬ã¼ã·ã§ã³ A1ï¼åããã®ãä½ã railsã¢ããªã±ã¼ã·ã§ã³ã®ä½æ â¦
Railsã§ã¯è¿½å æ©è½ããåºæ¬æ©è½ã®æ¡å¼µãªã©ã plugin ã¨ããæ¹æ³ã§è¡ãã¾ããpluginã¯æ§ã ãªã¨ããã§å ¬éãã¦ãã¦ãããã¸ã§ã¯ããã¨ã«ã¤ã³ã¹ãã¼ã«ãã¦ä½¿ç¨ãã¾ããpluginã®ç®¡çã«ã¯åºæ¬ãscript/plugin ã使ãã¾ãããã®ã³ãã³ãã§SVNã使ã£ã¦ãããããå¿ â¦
hibernate ã使ã£ã¦ãã¦ãæ®æ®µã¯ é¢é£ã lazyã§æ±ããããã ãã©ããããã¤ã³ãã§ã¯lazyãfalseã«ãã¦ä½¿ããããã¨ãããã¨ãããããããã®å ´åããããã³ã°ãã¡ã¤ã«ã®ã»ãã§ã¯ lazy=true ã«ãã¦ãããå¼ã³åºãããã°ã©ã ã®ã»ãã§æ示çã« FetchModeãå¤ãâ¦
ã¡ãã£ã¨ã¾ããªãµã³ãã«ã2.0.2ã®ä½æ³ã§ä½ã£ã¦ã¿ããã¨ã«ããã åèï¼http://www.kestrel.jp/modules/tinyd04//content/index.php?id=1ä¸è¨URLãåèã«ãrails2.0æµã«ã 1ï¼ãã¼ã¹ã®ä½æ é©å½ãªã¨ããã§ããã¤ãã®ãã¼ã¹ã®ä½æ $ rails rails_2.0-sample crâ¦
railsã®ãã¼ã¸ã§ã³ã2.0ã«ãã¦ãsqliteã使ãããã«ããã®ã§ãåããã scaffoldã§ä½ã£ã¦ã¿ããã¨ã«ãããããè²ã ã¨å¤æ´ããã¦ãã¦é常ã«ã¯ã¾ã£ãããã åèï¼http://d.hatena.ne.jp/idesaku/20071211/1197386955ããã¾ã§ã ã¨ããã¼ã¿ãã¼ã¹ã«ãã¼ãã«ãä½â¦
æè¿ã® rails ã¯ãã¼ãã«ã®ä½æã¯ãrake ã® migration ã¨ããã®ã使ããããã http://www.atmarkit.co.jp/im/carc/serial/proto04/proto04.html ï¼âãã®è¨äºã¯ç´°ããã¨ãããçµæ§ééã£ã¦ããããï¼ Rakeã¯Ruby Makeãã¤ã¾ããRubyçã®ãã«ããã¼ã«ã§ãããâ¦