Matrix Java Lecture: DAO mode application (Matrix Zhu Shijie)

xiaoxiao2021-03-06  77

(Farmer - Javen) 19:46:46

Time is here, start now!

Everyone welcomes Zhu Shijie to explain the application of DAO mode!

(_ Agum) 19:46:57

welcome

top

(Farmer - javen) 19:47:02

Still old habits, please use ordinary fonts, colors. Preliminary use of red

(Poplar) 19:47:04

啪啪, applaud

(_ Agou) 19:47:16

(Zhu Shijie) 19:47:18

Hello everyone, huh, I am honored to communicate with you.

(Foxcrane) 19:47:18

(& 咚咚) 19:47:19

Ok.

(Holleman's lover) 19:47:27

(foxcrane) 19:47:28

(Thinkinjava) 19:47:33

Great

(Farmer - javen) 19:47:34

(Chat and smile) 19:47:42

(Zhu Shijie) 19:47:48

let's start?

(Farmer - javen) 19:48:11

Ok! Start now!

(Yu Wei) 19:48:15

(_ Agum) 19:48:28

(Zhu Shijie) 19:48:35

DAO mode is familiar, that is, data access objects

(Zhu Shijie) 19:49:17

Originally, this part is Char, now I am in order to explain, I will not say these official languages.

(Zhu Shijie) 19:50:00

Do you think it is necessary to talk about the meaning of Dao, I want to talk directly, it is not enough.

(Zhu Shijie) 19:50:19

DAO's packaging has now been developed very mature

(Yu Wei) 19:50:22

(Poplar) 19:50:28

(Zhu Shijie) 19:50:47

I will introduce a solution for a while.

(Zhu Shijie) 19:50:55

Let me talk about it first.

(Zhu Shijie) 19:51:46

1. Traditional hierarchical structure, and some database isolation, etc.

(Zhu Shijie) 19:52:20

I don't have much to say these. 2, programming with interface

(Zhu Shijie) 19:52:37

Everyone can ask questions at any time

(Zhu Shijie) 19:53:10

Interface programming is not usually said, but after you add an entity, it's just a piece of interface.

(& 咚咚) 19:53:23

It should not be said to use the interface..

(Zhu Shijie) 19:53:31

That is, reflection and proxy

(& 咚咚) 19:53:31

The base class is the interface..

(& 咚咚) 19:53:49

Specific or class, not an interface..

(Zhu Shijie) 19:54:02

Oh, it is an interface, so I think it is especially

(Zhu Shijie) 19:54:13

No need for you to realize it

(Foxcrane) 19:54:20

What is the difference between this interface programming and everyone usually say?

Do you use DAO interface to solve the problem of multi-database support?

(Ice Cloud) 19:54:22

Is it called Named Query by an interface method name?

(Zhu Shijie) 19:54:54

To Foxcrane

(& 咚咚) 19:55:19

DAO is packaged with Data Source how might be interface .. I still don't understand.

(Zhu Shijie) 19:55:26

You haven't understood what I mean, saying that only interface, the program will act in its implementation

(Zhu Shijie) 19:55:42

TO ice cloud

(Zhu Shijie) 19:56:20

You said this later, but now, just talk about this crud

(Towa) 19:56:27

The program will act in its implementation?

(Zhu Shijie) 19:56:41

That is, dynamic agents.

(Towa) 19:56:58

Well, continue ~

(Foxcrane) 19:57:03

Oh, it seems that it is fun, pay attention

(Zhu Shijie) 19:57:27 Ordinary Save Add, etc., these are agents

(Zhu Shijie) 19:58:08

But what should I do with a business character? Only when you are doing

(& 咚咚) 19:58:37

That is, it is only necessary to add a service before Dao..

(Zhu Shijie) 19:58:37

Don't mean that you have to write so many code complexity

(Chat and smile) 19:59:52

Ok, interesting, dynamic agent

(Zhu Shijie) 20:00:17

Because Hibernate is Named Query, we can also use the agent's method, divided into 2 steps, 1, first plus its own business method in that entity interface.

(Zhu Shijie) 20:00:55

2, plus Named Query in the physical configuration

(Zhu Shijie) 20:01:22

This is more convenient than Namde Query that uses Hibernate.

(Zhu Shijie) 20:01:43

These 2 steps we have to do

(Zhu Shijie) 20:02:32

Any question

(Zhu Shijie) 20:02:56

This part is more difficult to understand

(Farmer - Javen) 20:03:02

Example? There are more problems, I don't understand!

(Chat and smile) 20:03:23

This gives this example

(Zhu Shijie) 20:03:33

OK

(Towa) 20:04:01

All have to be processed inside?

(Zhu Shijie) 20:04:10

Public interface usermgr {

Public Void Add (user user).

Public Void Update (user user) throws personistenceException;

Public Void Remove (User User) Throws PersistenceException;

Public User FindByPrimaryKey (long id) THROWS LOOKUPEXCEXCEPTION;

Public Collection Findall () THROWS LOOKUPEXCEPTION;

}

(Zhu Shijie) 20:04:47

If it is just a simple crUd, then we have to do so much after adding an entity.

(Farmer - Javen) 20:05:39

What do you say is another Pojo? Still implementing POJO, add this interface?

(Zhu Shijie) 20:05:52

That is the PO in Hibernate

(Zhu Shijie) 20:06:20

Correct

(Zhu Shijie) 20:06:59

It means simplified our CODE

(& 咚咚) 20:07:26

That is to turn a PO into a boner.

(Zhu Shijie) 20:08:18

According to my understanding, here, but only PO

(& 咚咚) 20:08:42

But your PO has added business logic .. such as add () .. Update, etc.

(Zhu Shijie) 20:09:11

No, PO is User, just posted Usermgr

(Thinkinjava) 20:09:19

It is not to add business logic in Po.

(Yuli Feng) 20:09:30

Set & Get

(Zhu Shijie) 20:09:33

Everyone may understand the wrong

(Zhu Shijie) 20:09:45

I added a layer outside of PO.

(& 咚咚) 20:09:45

Should be Dao to achieve your Usermgr interface

(& 咚咚) 20:10:04

Not an entity ..

(Zhu Shijie) 20:10:20

TO 咚咚:

(Towa) 20:10:36

Old Zhu, how to achieve dynamic agent ~?

(Zhu Shijie) 20:10:38

Maybe I am too chaotic, you misunderstood

(Zhu Shijie) 20:10:48

That way

(Yuli Feng) 20:11:06

Old Zhu put the usermgr name to Userdao, which is called UserDaoIMPL. It may be clear :)

(& 咚咚) 20:11:20

Ok..

(Zhu Shijie) 20:11:47

I didn't write MGR to DAO, because there is still a layer outside.

(& 咚咚) 20:12:02

Oh .. Which layer is that?

(Towa) 20:12:03

Is there a layer?

(_ Agou) 20:12:27

SERVICE? >

(& 咚咚) 20:12:37

It should be ..

(Towa) 20:12:38

Suggest,

Let's finish it, then let's ask questions.

(Zhu Shijie) 20:13:01

Packaging of data in business, business is also added here

(Zhu Shijie) 20:13:11

Wrong, it is the processing of data

(Zhu Shijie) 20:13:36

Simple crUd is not DAO

(Zhu Shijie) 20:14:36

If you adjust this MGR in the logical layer, the transaction will run to the logical layer, and it is violated the principle.

(Zhu Shijie) 20:15:26

Business Data Class - "Mgr -----" Po, where MGR is an interface, we don't implement it

(Zhu Shijie) 20:16:18

Simple crUd can write, complex queries and updates, you don't have to implement it in the configuration file

(Zhu Shijie) 20:16:50

But the premise is that your custom query method is in the name of the configuration file.

(Zhu Shijie) 20:17:15

The language is not good, everyone doesn't understand what to ask, I will give an example.

(Building a good story) 20:17:53

One-to-many, how many more don't pass the configuration file?

(Zhu Shijie) 20:18:48

This data ORM section, and there are not many relationships with DAO here, and it is already PO here.

(Zhu Shijie) 20:19:09

See your needs, you can 1

(Zhu Shijie) 20:19:17

Public Collection FindProductByname (String Name) Throws lookupexception;

(Zhu Shijie) 20:19:28

This is the method defined by yourself.

(Zhu Shijie) 20:20:06

From zzks.hibernate.user as user

Where user.id =?]]]]>

(Zhu Shijie) 20:20:14

Hibernate is like this

(Zhu Shijie) 20:20:50

Everyone has a question, there are not many time.

(Zhu Shijie) 20:20:58

There are still a lot behind

(Farmer - Javen) 20:21:31

If you don't finish you first! After you ask questions together, you can also

(Zhu Shijie) 20:21:41

Ok

(_ Agou) 20:21:47

Lao Zhu wants to see GF? >

(Zhu Shijie) 20:22:00

Isn't it for 1 hour?

(Zhu Shijie) 20:22:32

Today, everyone is coming to listen to the mode.

(Farmer - Javen) 20:22:35

There is no such provision. Most is 2 hours

(Zhu Shijie) 20:22:56

Let's talk about how this program is handled.

(Zhu Shijie) 20:23:12

How to deal with transactions, agents, and so on. (Zhu Shijie) 20:23:44

The agent here uses a Command mode

(Zhu Shijie) 20:24:07

I have a big code

(Zhu Shijie) 20:24:57

Class addcommand extends TransactionalCommand {

Protected Object Command (Object [] args, net.sf.hibernate.session session) throws exception {

Try {

Return session.save (args [0]);

} catch (hibernateException e) {

Throw New PersistenceException ("Unable to add new object to the datastore", e);

}

}

}

(Zhu Shijie) 20:25:39

This thing is the summary of foreigners, just not perfect, even can't compile it, I have changed it.

(Zhu Shijie) 20:26:30

Extends a transaction Command

(Ice Cloud) 20:26:52

Hey, this is good.

(Zhu Shijie) 20:27:12

Use template mode (as if I don't know these nouns)

(Ice Cloud) 20:27:24

I think it is best to use the Command mode in the case of using hibernate, not DAO.

(_ Agum) 20:27:48

Waiting for Lao Zhu :)

(Zhu Shijie) 20:28:16

TO Ice Cloud: My understanding is that DAO is relatively wide, Commmadn is just wrapped

(Zhu Shijie) 20:28:43

Let's take a look:

(Zhu Shijie) 20:28:46

Abstract Class TransactionalCommand IMPLEMENTS Command {

Public Object Execute (java.lang.reflect.Method Method, Object [] args, session session) throws Exception {

IF (args == null || args [0] == NULL) {

Throw New PersistenceException ("Null Target Record Cannot Be Added, Updated, or Removed);

}

Transaction txn = session.begintransaction ();

Try {

Object results = Command (args, session);

Txn.commit ();

Return Result;

} finally {

IF (! txn.wascommitted ()) {

Txn.rollback ();

}

}

}

Protected Abstract Object Command (Object [] args, session session;

}

(Ice Cloud) 20:28:52

Right ~

(Zhu Shijie) 20:29:58

This is an abstract class. It was originally char, he would like to talk about these modes, and the result is only I am vague.

(Zhu Shijie) 20:31:21

Use this template to put the transaction.

(Zhu Shijie) 20:31:37

Is there a problem

(Zhu Shijie) 20:32:28

This is an example of the realization of ordinary crudation

(Zhu Shijie) 20:32:59

Named Query also has a corresponding Command

(Zhu Shijie) 20:33:23

All such operations have their own Command.

(Zhu Shijie) 20:33:56 Let's talk about the treatment of sessions

(Zhu Shijie) 20:34:37

It's old here, huh, huh, it's also Threadlocal.

(Zhu Shijie) 20:35:04

I have sent an article in Matrix, saying this.

(Zhu Shijie) 20:34:37

It's old here, huh, huh, it's also Threadlocal.

(Zhu Shijie) 20:35:04

I have sent an article in Matrix, saying this.

(Zhu Shijie) 20:35:53

Session is saved in threadlocal

(Zhu Shijie) 20:36:03

Production can be implemented in plant mode

(Zhu Shijie) 20:36:48

Is there a problem

(Zhu Shijie) 20:37:03

Didn't talk about the agent

(Zhu Shijie) 20:37:59

I just didn't talk about it, saying that we only do an interface, don't you achieve it?

(Zhu Shijie) 20:38:15

So how do we call?

(Zhu Shijie) 20:38:52

Here with ServiceLocate

(Zhu Shijie) 20:39:41

Public interface service service {

Object GetDomainObjectManager (Class ManagerClass)

(Zhu Shijie) 20:41:00

Toned Mgr here

(Farmer - Javen) 20:42:16

Where is the implementation?

(Zhu Shijie) 20:42:17

Specific implementation

(Zhu Shijie) 20:42:19

Public Object GetDomainObjectManager (class managerclass) throws serviceLocatorException {

Validate (ManagerClass);

Return Proxy.newProxyInstance (ManagerClass.getClassLoader (), New class [] {managerclass},

New managerdelegate ());

}

(Zhu Shijie) 20:42:49

It is the agent here.

(Zhu Shijie) 20:44:06

Private static class managerdelegate imports invocationhandler {

Private logger log = logmanager.getlogger (getclass ());

Public Object Invoke (Object Proxy, Method Method, Object [] args throws throwable {

Command Command = ResolVecommand (Method);

IF (command == null) {

Throw new unsupportedOperationException ();

}

Try {

Return Command.execute (Method, Args, GetSession ());

} catch (exception e) {

INVALIDATESSION ();

Throw e;

}

}

(Zhu Shijie) 20:44:40

It's not a step in step here, it's still asking questions.

(Yu Wei) 20:45:51

Talk about the benefits of this, the code is discrete, it looks a bit tired.

(Zhu Shijie) 20:46:07

Great

(Farmer - Javen) 20:46:16

I still don't understand! Dao can also be so complicated, the purpose is to reduce the amount of code

(Zhu Shijie) 20:46:40

It seems that my language is too bad, huh, I will explain it.

(Farmer - Javen) 20:46:44

I have written DAO now, especially JDBC, and the amount of code is really too big. Also thinking (Zhu Shijie) 20:47:10

Take a farmer to give example.

(Zhu Shijie) 20:47:45

Are you writing a DAO, you have to write an ADD, UPDATE, DEL, FIND, etc.

(Farmer - Javen) 20:48:23

Yes. Then add N Query, according to the complexity of the business

(Zhu Shijie) 20:48:36

These operations of each entity, in addition to the physical name, HQL is the same.

(Yu Wei) 20:49:01

Basically

(Farmer - Javen) 20:49:29

Well, put Query one side first. Also said. CRUD is basically the same

(Yu Wei) 20:49:34

The way I want to take is to write a simple code generation tool, which is implemented.

(Zhu Shijie) 20:50:13

The code generation tool is also to implement the code, :), why not write an interface, use the agent to implement it?

(Zhu Shijie) 20:50:35

Farmers, now talk about Crud

(& 咚咚) 20:51:17

Use the interface .. Good idea ..

(Join) 20:51:36

CDT is too cool

(Zhu Shijie) 20:52:09

CDT is it?

(Farmer - Javen) 20:52:13

Join: Now is a lecture time

(Zhu Shijie) 20:52:37

Farmers, understanding.

(Join) 20:53:05

Sorry

(Zhu Shijie) 20:53:36

The peasants just said to put the query, now query.

(Farmer - Javen) 20:53:52

Oh, I don't understand the dynamic agent. After you have studied it carefully.

It seems that the dynamic agent can do a lot of things, such as Spring implementation AOP seems to use the dynamic agent?

(Zhu Shijie) 20:54:27

Reflection and agents are really convenient

(Zhu Shijie) 20:55:23

For example, the agent first view the add method you call, then find the addcommand by addCommand according to the addCommand.

(Zhu Shijie) 20:55:57

Then execute the Execute method for addcommand

(Zhu Shijie) 20:56:29

Execute also has your usermgr's User

(Farmer - Javen) 20:57:05

In the service, what do you need to do?

(Zhu Shijie) 20:57:23

What is your SERVICE?

(Farmer - Javen) 20:58:21

Do you not say DAO now? I am in service / business, to call this DAO to save User to the database. Specific code?

(Zhu Shijie) 20:59:55

Usermgr trh = (usermgr) GlobalServiceLocator.get ().

(Zhu Shijie) 21:00:22

Usermgr trh = (usermgr) GlobalServiceLocator.get ().

GetDomainObjectManager (TH);

(Zhu Shijie) 21:00:59

Then use this mgr.add ()

(Zhu Shijie) 21:01:58

ServiceLocator

(& 咚 响) 21:02:44

I think it should be ServiceLocator to call service.

(Yulian) 21:03:07

Well, I look beautiful. Usermgr trh = (usermgr) GlobalServiceLocator.get (). If you use Spring, you can configure it in the bean, then you can convert specific implementations (& 响) 21:03: twenty three

Because only serviceLocator knows that service is there ..

(Zhu Shijie) 21:03:59

Do you say service is business data processing?

(& 咚 响) 21:04:24

But the farmer said that you should just let it be.

(Yu Wei) 21:04:27

However, the following is back to the local handling, if I add several times, Update is several times, DEL is several times, as if the transaction control has a problem.

(Zhu Shijie) 21:04:38

Oh, right

(Yu Wei) 21:04:51

Because you just do transaction for crudation

(Zhu Shijie) 21:05:17

I have discussed here in the past few days, some said that it is a business inlay.

(Zhu Shijie) 21:05:30

Later summed up

(Yu Wei) 21:05:49

I think the transaction should be handled in Service / Business.

(Zhu Shijie) 21:06:05

Listen to me, finish.

(Zhu Shijie) 21:06:18

I also consider this for a long time.

(Yu Wei Feng) 21:06:51

Oh, I will wash my ear :)

(Zhu Shijie) 21:06:56

Which JTA is used alone or Hibernate's own transaction, or EJB transaction

(& 咚咚) 21:07:25

If you are in Spring..

(& 咚 响) 21:08:03

Is it better to use JTA ...

(Zhu Shijie) 21:08:10

If there is no EJB, the transaction is also placed in the service layer.

(Zhu Shijie) 21:08:52

The reason I don't want to bring Hibernate's transaction to service.

(Zhu Shijie) 21:09:05

Because this is relatively large between the 2 layers

(& 咚 响) 21:09:12

The transaction is handled .. That means the entire business process is also in Service.

(Farmer - Javen 21:09:31

If you use Spring, which transaction can be used, it is good. He has a transaction abstract layer. Introduction, this is one of its advantages

(Zhu Shijie) 21:10:37

To 咚咚 响, should not be said, it should be a business to the entity

(Zhu Shijie) 21:11:08

Maybe there will be other JMS processing

(& 咚 响) 21:11:30

Oh .. I haven't considered JMS .. Hehe ..

(Zhu Shijie) 21:11:32

Multiple facade huh, huh

(Zhu Shijie) 21:12:14

It's okay, it's okay.

(& 咚 响) 21:12:19

If there is no EJB.. I don't have to use Facade necessary ..

(char) 21:12:52

Hello everyone...

(char) 21:13:12

What is the problem?

(Farmer - Javen 21:13:18

I finally came!; Char explained the mode it used here.

(Zhu Shijie) 21:13:36

To 咚咚, talk about this change, superline, huh, huh

(char) 21:13:47

Can farmers can't send a record that just now ...

(& 咚 响) 21:13:49

Oh .. I am sorry ..

(Square film) 21:14:05

In my, wait

(Zhu Shijie) 21:14:18

Charr

(char) 21:14:24

Sorry, I will have a chance next time, I will add GOF again, this time, I will turn the DAO.

(char) 21:14:37

Shijie,

(Zhu Shijie) 21:14:46

It is what I said with you.

(Zhu Shijie) 21:14:56

You talk about it.

(Farmer - javen) 21:15:39

Dynamic agent. About Query processing.

(char) 21:15:40

Continue me, let's start, I may not pick up with the DAO of Shijie ...

(char) 21:15:51

Do you want to post a few pictures first?

(Farmer - Javen) 21:16:00

it is good! welcome

(Farmer - Javen 21:16:19

You can map.

(char) 21:16:31

(char) 21:16:47

Gof's most basic thing ...

(char) 21:17:28

All patterns are basically several principles:

(char) 21:17:53

(Farmer - Javen) 21:18:08

Maybe the server is too slow, I can't receive the picture!

(Zhu Shijie) 21:18:17

me too

(char) 21:18:42

(char) 21:19:08

No, then don't watch ...

(Building a good story) 21:19:18

paste

(Thinkinjava) 21:19:24

paste

(char) 21:19:37

(char) 21:19:43

Can you see it?

(Thinkinjava) 21:19:49

can

(Zhu Shijie) 21:19:50

Keyi

(Mud doll) 21:20:09

CHAR, powerful,

Find so much picture :)

(char) 21:20:13

(Building a good story) 21:20:19

Great.

(Farmer - javen) 21:20:23

Char: Change your font to red

(char) 21:20:28

Not looking for. Using Mindmanger, prepared a few days ago

(Yu Wei) 21:21:02

I fainted, I can't see mud :(

(Yu Wei) 21:21:06

Too slow

(char) 21:21:27

I use this color to distinguish between the color, the color of the leader ...

(Thinkinjava) 21:21:51

Do you want to share the file of Mindmanger directly?

(char) 21:22:02

How to share?

(char) 21:22:15

Ok, this will be sent to you tomorrow.

(Mud doll) 21:22:26

It's good, or good char.

(Yu Wei) 21:22:45

Send it to me, I open a service, everyone download

(char) 21:23:14

Shijie, you will continue. Let me see what you said in front.

(Zhu Shijie) 21:24:19

Ok

(Zhu Shijie) 21:24:40

Farmers, continue to do it just now

(Zhu Shijie) 21:24:48

Query problem

(Zhu Shijie) 21:25:23

There is a named query in Hibernate, which is based on this.

(Zhu Shijie) 21:26:23

Don't say, I don't know if it should be explained here?

(Yu Wei) 21:26:42

Oh, listening to :)

(& 咚咚) 21:26:44

we have a deal..

(Zhu Shijie) 21:27:34

Named Query's purpose is to want to separate HQL in the configuration file so that DBA is optimized, nor codes

(Farmer - Javen 21:27:44

Sorry, because I am not familiar with hibernate's named query. It seems to be a bit out of date ...

(Zhu Shijie) 21:28:50

Simply put, it is to write the SQL language written in the class, write in the XML file, a good change (Zhu Shijie) 21:30:10

It's not outdated, but you are too strong, huh, huh.

(Zhu Shijie) 21:30:44

Named Query is what this means

(Zhu Shijie) 21:30:54

Generally do not need DAO

(Zhu Shijie) 21:31:32

It is directly using Hibernate's named query, in this program, pack it.

(Zhu Shijie) 21:32:25

When we call Query you define, the agent will help us hand over the processing to Hibernate, we as long as the result

(dfdfswsw) 21:32:53

YOU MAY EVEN Define a named query in the mapping document.

Named query = SQL XML Map ..

(Farmer - javen) 21:33:03

Can you share a DEMO? Xiao Zhu?

(char) 21:33:11

Basically I feel that DAO is the currently better design framework.

(DFDFSWSW) 21:33:15

From eg.domesticcat as cat

Where cat.name =?

And cat.weight>?

]]>

(dfdfswsw) 21:33:22

Query Q = sess.getnamedQuery ("eg.domesticcat.by.name.and.minimum.weight");

Q.setString (0, name);

Q.Setint (1, minWeight);

List cats = q.list ();

(char) 21:33:49

Farmers should say that a good example of Dao can find AppFuse to see.

(Zhu Shijie) 21:33:53

1167374 is very right

(Farmer - javen) 21:34:08

DAO should be one of the most design patterns. The key is now more abstract, more powerful

(Zhu Shijie) 21:34:27

Just the simpler can be done

(char) 21:34:34

I introduce the level of appfuse:

DAO layer

Service layer

View layer

(DFDFSWSW) 21:34:54

Sorry, everyone is busy with the CNNIC domain.

JMS discussion did nothing. . . sry

(char) 21:35:29

A article translated in Totodo has detailed Domain object, with the relationship between 3 different layers.

(Farmer - javen) 21:35:56

DFDF We determine time, you will talk about JMS. Now talking about Dao and Mode this topic

(DFDFSWSW) 21:36:28

know. . I am listening. . ^ 0 ^

(& 咚 响) 21:36:43

Well .. I also got appfuse ..

(Farmer - javen) 21:37:04

Domain should be shared data between different layers, which can be passed to different layers. Simple point is Pojo

(Farmers - javen) 21:37:46

Now the scheme of Shijie is to say, through dynamic agents, greatly reduce the code quantity of the DAO layer.

(Zhu Shijie) 21:38:17

Yes

(Farmer - javen) 21:38:21

The Service layer is simple to simple applications. VIEW plan can be familiar, it seems

(Farmer - javen) 21:39:44

Char: Continue, DAO layer for design model! (Zhu Shijie) 21:40:17

I have to say that he is saying.

(char) 21:40:28

Ok, continue

(Zhu Shijie) 21:40:33

Just talking about Named Query

(char) 21:40:35

Shijie, please continue

(Zhu Shijie) 21:40:50

Everyone understands, then you can continue.

(Zhu Shijie) 21:41:18

Each operation, whether it is crud, or its own query

(Zhu Shijie) 21:41:50

Both use command to pack

(Zhu Shijie) 21:42:03

Have your own Execute method inside

(Zhu Shijie) 21:42:26

The agent is based on the name of the corresponding Execute method.

(Zhu Shijie) 21:43:16

Do you understand?

(Zhu Shijie) 21:43:32

I am very hoping that everyone can understand what I mean, really

(Farmer - javen) 21:43:32

In addition to the same packaging (transaction), it seems to be the corresponding method of hibernate called.

(Zhu Shijie) 21:43:55

Yes, farmers said

(Zhu Shijie) 21:44:08

DAO is just a packaging

(Farmer - javen) 21:44:23

Can you share a Demo after willing, Demo is a relatively special DAO implementation.

(Zhu Shijie) 21:44:25

I am just a packaging outside Hibernate.

(Zhu Shijie) 21:45:11

This packaging is different from other packaging, and you don't need to implement code. You write an interface, including the method you want to use.

(dfdfswsw) 21:45:14

For example, ABC is Abcexectute?

Just like the XX.DO or XX.xx of Struts?

(Zhu Shijie) 21:46:27

Demo I thought, do Demo is not as good as a JAR in Martix

(Farmer - javen) 21:47:04

Already there? I will put it in this meeting record, for everyone to download

(Zhu Shijie) 21:47:26

I am already used.

(Zhu Shijie) 21:47:42

After this meeting

(Farmer - javen) 21:48:37

Usermgr trh = (usermgr) GlobalServiceLocator.get ().

GetDomainObjectManager (TH);

In fact, I still don't understand, where is this Usermgr? Is there anything to achieve?

(Zhu Shijie) 21:48:53

Is not achieved

(Zhu Shijie) 21:49:10

So simply, reduce the amount of code

(Farmer - javen) 21:49:48

Do you have any questions? Two hours, it seems that the design mode of char will talk about next time?

(Zhu Shijie) 21:49:52

Add an entity PO, just add an interface (MGR)

(char) 21:50:09

In fact, the concept of the DAO model and Spring's implementation of the world is very similar.

(Farmer - javen) 21:50:26

Ok. I urgently want to see this JAR (source code?), See where the mysteries are, huh, huh

(Zhu Shijie) 21:50:36

Repeated operations like OpenSession are not written before writing.

(char) 21:50:37

Shijie, should be a new type of entity PO, just need to add an interface.

(Zhu Shijie) 21:50:49

Yes, it is a class

(char) 21:51:04

Because many times, involving one-on-one, when one is more, only one DAO can solve the order. (Farmer - javen) 21:51:17

There is indeed like Spring Template

(Zhu Shijie) 21:51:58

Similar because it is used to reflect

(char) 21:52:43

In fact, it is a concept, and a good framework is based on the same principles, because it will be very large,

Just like HibEntate and JDO, Struts and Webwork,

Because it is based on a better design principle, it will be easily accepted.

(Farmer - javen) 21:53:14

Summarize!

(log4u) 21:53:48

This is fast

(Zhu Shijie) 21:54:24

This failed this time, I didn't let everyone understand.

(Farmer - javen) 21:55:04

No. Just this place is indeed complicated. What is the dynamic agent, I have not so much understanding, haha

(Farmer - javen) 21:55:17

Ok, come here today! Thank you very much for Zhu Shijie to share your knowledge! Also welcomes the future of the future to share the design model in the near future!

(Farmer - javen) 21:55:33

(Zhu Shijie) 21:55:39

Thank you, polite

(_ Agou) 21:56:02

(Yu Wei Feng) 21:56:05

Oh, look forward to the source code :)

(char) 21:56:20

Hard sense

(Zhu Shijie) 21:56:21

Exterior: Farmers, I will make this package, give big home

(Farmer - javen) 21:56:39

I will organize the color version of the record as soon as possible for you to download. And the source code of Shijie contributed! Thank you again!

(Zhu Shijie) 21:56:59

Too polite

(Farmer - Javen) 21:57:36

I think it is very successful: because give you a new idea! To be honest, I just thought that DAO didn't seem to have too much content, Shijie gave me a surprise

(dfdfswsw) 21:57:38

In fact, I think it should be not only used to hibentate.

You can implement this interface yourself

Just get an OjBectManager with a serivce

Then directly for an OjBect (bean)

(Yu Wei) 21:58:16

Oh, my idea has been in the code generation tool :)

(Farmer - Javen) 21:58:31

Spring is for each Persistence scenario, has template, such as JDBCTemplate HibernateTemplate

We can also study this solution and Spring

(char) 21:58:52

There is a flexible implementation in Roller

It is a very roller's DAO layer to convert Hibernate or Castor JDO at any time.

(Farmer - javen) 21:58:59

TO: Yulin Wind This place is generated by code, and it feels simple to have this solution.

(char) 21:59:19

This is the smart and flexible place for the dynamic agent of Shijie..

(Yu Wei) 21:59:19

Yes:)

(Farmer - Javen 21:59:38

Char: I also studied. But I feel that his Condition is more complicated and is a little dizzy. Is Query function

(char) 21:59:45

what does this mean?

(Farmer - javen) 21:58:59

TO: Yuli Feng This place is generated by code, it feels not yet

(DFDFSWSW) 22:00:19 I used

Ibatis will be used after this.

Still which is recommended. thank you

(Farmer - javen) 22:00:22

TO: Yulin Wind This place is generated by code, and it feels simple to have this solution.

This dynamic agent program

(Yu Wei style) 22:00:44

I feel Ibatis or more suitable in the company :)

(char) 22:00:48

Code generation, what code is generated?

(Farmer - Javen) 22:00:52

DFDF said that I have been using Ibatis?

(DFDFSWSW) 22:00:58

Not always

(Farmer - Javen) 22:01:20

Yuli Feng said: Generate the DAO generator with code, of course, you want to write yourself.

(DFDFSWSW) 22:01:31

Previously used hibernate

Later, I added this group to start using Ibatis.

(Farmer - Javen) 22:01:51

Your feelings: Where is their advantages and disadvantages?

(Farmer - Javen) 22:01:58

Because you have practical application experience

(DFDFSWSW) 22:02:04

In the CNNIC project, I made a small MVC framework in Webwork.

(char) 22:02:12

Oh, this is easy, write a template with xdoclet, you can generate all the pages, including Struts, DAO, JSP ...

(DFDFSWSW) 22:02:45

Correct description iBATI is not an O / R Map

Just a SQL <-> XML Map

(Farmer - javen) 22:02:48

Char: Do you write it out? I am interested in seeing. Haha

(char) 22:03:18

Generate the JSP that code appfuse is there.

(char) 22:03:28

You can generate another elsewhere.

(Farmer - javen) 22:03:33

DFDF is doing CNNIC? Powerful

(DFDFSWSW) 22:03:51

No. . It is the domain name system of CNNIC. .

(Use it your company.) Misunderstood

(Farmers - javen) 22:03:58

TO Char: I really don't pay too much attention.

(char) 22:03:59

Simple point No xDoclet can use Velocity.

(DFDFSWSW) 22:04:06

Velocity is easy to use

(DFDFSWSW) 22:04:32

My own small frame velocity ibatis

(char) 22:04:56

I am using Velocity to do templates.

However, it has not been generated, and the JSP has been tried.

(Yu Wei) 22:05:16

I have considered Velocity :)

(DFDFSWSW) 22:05:23

I am not generating JSP .. use it directly to generate output

(Yuli Feng) 22:05:56

Can pass Velocity Sitemesh, convenient

(DFDFSWSW) 22:06:33

Design a bean interface with a Boolean's Checkform method

Then design an ActionRouter yourself (refer to other MVC)

mode

Then also an action interface

(char) 22:07:14

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

(char) 22:07:25

Yuli also has used Sitemesh?

(DFDFSWSW) 22:07:57

Sitemesh I have been very familiar to just ran an example.

(Farmer - javen) 22:08:07

TO: Yulin Wind This place is generated by code, and it feels simple to have this solution. Interested to see how it is used.

(Yu Wei) 22:08:21

I just saw a Demo, but I feel more comfortable than TILE:) (Farmer - Javen) 22:08:24

Halo, I am wrong.

(Yu Wei) 22:09:06

But Tile I don't use :) Our company has a template solution, huh, it is straightforward, don't need these things.

(DFDFSWSW) 22:09:09

I feel that Sitemesh is not as good as a complete MVC

Then v uses velocity

(char) 22:09:10

Yes, it is also the meaning of XLoadTree's big bug, what does it mean?

(Farmer - javen) 22:09:36

Velocity is similar to Sitemesh seems to be more similar, is the template output view?

(Yuli Feng) 22:09:44

Sitemesh seems not a MVC solution, it is just an increase in INCLUDE.

(DFDFSWSW) 22:09:48

Then define a set of template variables yourself.

(char) 22:10:03

Sitemesh is a replacement of Tiles

(DFDFSWSW) 22:10:05

Yep. Sitemesh is not a View layer

(Yu Wei) 22:10:14

XLoadTree: It is not its bug, I didn't see the crypt source.

(Yuli Feng) 22:10:50

Sitemesh is the most attractive me that it won't break the page

(char) 22:11:03

Have you tried using XLoadTree display file system

(Yu Wei) 22:11:35

Oh, I ran a Demo I wrote myself on my machine, used to give another group of friends :)

(Yu Wei) 22:11:47

Is the file system used to display

(char) 22:11:48

send to me

(Yu Wei) 22:12:04

Boss, for a long time, there is no longer

(dfdfswsw) 22:12:13

Such as company news system module

There is list, find, create, update in NewsAction

Waiting for a method, use a JavaBean to pass 1 or few

Velocity display

(Zhu Shijie) 22:16:46

I don't understand so much, I use struts, the function is enough.

Reprinted from: http://www.matrix.org.cn