HİBERNATE TEKNOLOJİLERİNE Giris,

Guzel bulmus oldugum iyi bir calismayi,  Sizinle paylasmak istedim.

Bu dosya  Hacettepe universitesinin internet sayfasindan indirilmistir.

Hazırlayan : Adem Öztürk   <<  Tesekkur ederim kendisine. İÇİNDEKİLER: 1. GİRİŞ: .................................................................................................................................... 3 2. HİBERNATE ÇALIŞMA İLKELERİ VE MİMARİSİ......................................................... 4 3. SESSIONFACTORY YAPILANDIRMASI............................................................................ 6 3.1 Programlama yoluyla yapılandırma ................................................................................. 6 3.2 SessionFactory elde etme ................................................................................................. 7 3.3 JDBC baglantıları............................................................................................................. 7 3.4 XML Yapılandırma Kütüğü............................................................................................. 7 4. KALICI SINIFLAR (PERSISTENT CLASSES) .................................................................. 8 4.1 Kalıcı sınıfların temel özellikleri.................................................................................... 10 4.2 Kalıcı sınıflarda ayırıcı (identifier) alanı ve Veri tabanı birincil anahtar niteliği ilişkisi .............................................................................................................................................. 10 4.3 Final tanımlanmış sınıflar ve türemiş sınıflar ................................................................ 10 4.4 equals() , hashCode() metotları hakkında ...................................................................... 10 4.5 Güncelleme, silme önlemleri ve yaşam döngüsü ara yüzü ............................................ 11 5. BASİT NESNE/İLİŞKİSEL MODEL EŞLEME (OBJECT/RELATİONAL MAPPİNG). 11 5.1 Nesne/ilişkisel model eşleme(Object/Relational Mapping) kütüğü içeriği.................... 14 5.1.1 Doctype ................................................................................................................... 14 5.1.2 hibernate-mapping................................................................................................... 14 5.1.3 class......................................................................................................................... 14 5.1.4 id.............................................................................................................................. 15 5.1.5 property ................................................................................................................... 16 5.1.6 many-to-one ............................................................................................................ 16 5.1.7 one-to-one................................................................................................................ 17 5.1.8 subclass.................................................................................................................... 17 6. KALICI VERİNİN İŞLENMESİ (MANİPULATİNG PERSİSTENT DATA ) ................. 17 6.1. Kalıcı nesnenin oluşturulması ....................................................................................... 17 6.2 Kalıcı nesnenin geri yüklenmesi(loading of a persistent object) ................................... 18 6.3 Sorgulama (Querying).................................................................................................... 19 6.4 Güncelleme ve Silme ..................................................................................................... 20 7. ÖRNEK UYGULAMALAR................................................................................................ 21 7.1 Örnek uygulama 1 .......................................................................................................... 21 7.1.1 eşleme (mapping) kütükleri..................................................................................... 21 7.1.2 Hibernate.properties kütüğü.................................................................................... 22 7.1.3 Şema oluşturma ....................................................................................................... 23 7.1.4 Kalıcı sınıfları oluşturma......................................................................................... 23 7.1.5 Hibernate ile Kalıcı Sınıfları Kullanma .................................................................. 23

Download link: Hibernate_giris_Adem…._fileserver_mirror_kutayzorlu.com

Maven, What is Maven? , What is Maven doing?

Convention over configuration (also known as coding by convention) is a software design paradigm which seeks to decrease the number of decisions that developers need to make, gaining simplicity, but not necessarily losing flexibility.

The phrase essentially means a developer only needs to specify unconventional aspects of the application. For example, if there is a class Sale in the model, the corresponding table in the database is called “sales” by default. It is only if one deviates from this convention, such as calling the table “product sales”, that one needs to write code regarding these names.

When the convention implemented by the tool matches the desired behavior, it behaves as expected without having to write configuration files. Only when the desired behavior deviates from the implemented convention is explicit configuration required.

 

maven.structure

 

 

 

Aspect oriented programming (AOP)

In computing, aspect-oriented programming (AOP) is a patented[1] programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns. It does so by adding additional behavior to existing code (an advice) without modifying the code itself, instead separately specifying which code is modified via a “pointcut” specification, such as “log all function calls when the function’s name begins with ‘set'”. This allows behaviors that are not central to the business logic (such as logging) to be added to a program without cluttering the code core to the functionality. AOP forms a basis for aspect-oriented software development.

AOP includes programming methods and tools that support the modularization of concerns at the level of the source code, while “aspect-oriented software development” refers to a whole engineering discipline.

Aspect-oriented programming entails breaking down program logic into distinct parts (so-called concerns, cohesive areas of functionality). Nearly all programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g., functions, procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. Some concerns “cut across” multiple abstractions in a program, and defy these forms of implementation. These concerns are called cross-cutting concerns.

Logging exemplifies a crosscutting concern because a logging strategy necessarily affects every logged part of the system. Logging thereby crosscuts all logged classes and methods.

All AOP implementations have some crosscutting expressions that encapsulate each concern in one place. The difference between implementations lies in the power, safety, and usability of the constructs provided. For example, interceptors that specify the methods to intercept express a limited form of crosscutting, without much support for type-safety or debugging. AspectJ has a number of such expressions and encapsulates them in a special class, an aspect. For example, an aspect can alter the behavior of the base code (the non-aspect part of a program) by applying advice (additional behavior) at various join points (points in a program) specified in a quantification or query called a pointcut (that detects whether a given join point matches). An aspect can also make binary-compatible structural changes to other classes, like adding members or parents.

 

void transfer(Account fromAcc, Account toAcc, int amount, User user,
    Logger logger) throws Exception {
  logger.info("Transferring money…");
 
  if (!isUserAuthorised(user, fromAcc)) {
    logger.info("User has no permission.");
    throw new UnauthorisedUserException();
  }
 
  if (fromAcc.getBalance() < amount) {
    logger.info("Insufficient funds.");
    throw new InsufficientFundsException();
  }
 
  fromAcc.withdraw(amount);
  toAcc.deposit(amount);
 
  database.commitChanges();  // Atomic operation.
 
  logger.info("Transaction successful.");
}

 

 

Spring Modules

Java spring modules list

  • Spring Core Container: This is the base module of Spring and provides spring containers (BeanFactory and ApplicationContext).[6]
  • Aspect-oriented programming: enables implementing cross-cutting concerns.
  • Authentication and authorization: configurable security processes that support a range of standards, protocols, tools and practices via the Spring Security sub-project (formerly Acegi Security System for Spring).
  • Convention over configuration: a rapid application development solution for Spring-based enterprise applications is offered in the Spring Roo module
  • Data access: working with relational database management systems on the Java platform using JDBC and object-relational mapping tools and with NoSQL databases
  • Inversion of control container: configuration of application components and lifecycle management of Java objects, done mainly via dependency injection
  • Messaging: configurative registration of message listener objects for transparent message-consumption from message queues via JMS, improvement of message sending over standard JMS APIs
  • Model–view–controller: an HTTP- and servlet-based framework providing hooks for extension and customization for web applications and RESTful Web services.
  • Remote access framework: configurative RPC-style marshalling of Java objects over networks supporting RMI, CORBA and HTTP-based protocols including Web services (SOAP)
  • Transaction management: unifies several transaction management APIs and coordinates transactions for Java objects
  • Remote management: configurative exposure and management of Java objects for local or remote configuration via JMX
  • Testing: support classes for writing unit tests and integration tests

Windows command line, BAT file Compile java

1- Very important.

To create a similar batch file, you should verify the full paths to any directories that you want to

add to your system PATH variable. Then you can make any necessary changes to this
example code, and save it as a batch file on your system.
You can download a copy of my batch file using this URL:

kutay.bat

How to Run,

 

what is Model in MVC ?

MVC is

  • Data (Model)
  • An interface to view and modify the data (View)
  • Operations that can be performed on the data (Controller)

 

M + V = C>>    Controller is  preparing Model then creating  View.

In the Center  there is a Controller

 

For Simple  >   Model = ‘ DATAS’    

* The model is the data, and does nothing else.

Models (All of models in project ) does NOT depend on the controller or the view.

Controller Calling Model then  pushing it  to  View.    Controller is handling. But for the preparing the datas,  controller does not effect  how the model creating data sets, structs, objects.

Controller says model to that: Prepare user_table[array] ,

After pushing this  object  to  View,  View is using this table,

 

what is Controller ?

Such as button clicks. The controller depends on the view and the model.

Events.

The controller and the view are the same object. WHY >    You can return   a string   as a page   return  “”

 

 What is the Advantage of model ?

Unnecessary complexity is the devil of software development.

Time loss for companies.  .  Complexity leads to software that is buggy, and expensive to maintain.

The easiest way to make code overly complex is to put dependencies everywhere.

* You can use model, Directly  Copy paste inside of another  Project.  You can Call the Model from  different  Views, or Controllers.
>>  Conversely, removing unnecessary dependencies makes delightful code that is less buggy and easier to maintain because it is reusable without modification.

* The primary advantage of the MVC is that makes model classes reusable without modification.